5 Using Java, Start with the following source code: // Driver.java public class Driver public static void main(String[]

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

5 Using Java, Start with the following source code: // Driver.java public class Driver public static void main(String[]

Post by answerhappygod »

5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 1
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 1 (78.4 KiB) Viewed 46 times
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 2
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 2 (77.2 KiB) Viewed 46 times
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 3
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 3 (67.45 KiB) Viewed 46 times
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 4
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 4 (57.96 KiB) Viewed 46 times
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 5
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 5 (99 KiB) Viewed 46 times
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 6
5 Using Java Start With The Following Source Code Driver Java Public Class Driver Public Static Void Main String 6 (41.02 KiB) Viewed 46 times
5 Using Java, Start with the following source code: // Driver.java public class Driver public static void main(String[] args) { // TODO Auto-generated method stub Filelo a1 = new FilelO("Z:\\JavaPrograms2\\assignment336b\\src\ \Salesdat.txt"); Franchise f = a1.readData(); } 3 //FilelO.java import java.io.* import java.util.*: public class Filelo private String frame = null; private boolean DEBUG = true; public FilelO(String fname) { this.fname = fname: 3 public Franchise readData() { Franchise ai = null; int counter = 0; try FileReader file = new FileReader(frame): Buffered Reader buff = new BufferedReader(file): String temp: boolean eof = false; while (!eof) String line = buff.readLine():

Buffered Reader buff = new BufferedReader(file); String temp: boolean eof = false; while (Leof) { String line = buff.readLine(); counter++; if (line == null) eof= true; else { if (DEBUG) System.out.println("Reading" + line): if (counter == 1) { temp = line; al = new Franchise(Integer.parseInt(temp)); if (DEBUG System.out.println("d! + al.numberofstores(); 3 if (counter == 2) if (counter> 2) { int x = buildStore(a1, (counter-3), line); if (DEBUG) System.out.println("Reading Store #"+counter-2)+" Number of weeks read = + x): if (DEBUG) ( System.out.println("Data read:"); al.getStores(counter-3).printdata(): buff.close(): } catch (Exception e) { System.out.println("Error *+e.toString(): return al: > public int buildStore(Franchise ai, int counter String temp) Art

M System.out.println("Error -- "+e.toString): 3 return al; 3 public int buildStore(Franchise an, int counter, String temp) { Store tstore = new Store(); String si = ""; float sale = 0.0f; int week = 0; int day = 0; StringTokenizer st = new StringTokenizer(temp): while (st.hasMoreTokens() { for(day=0;day<7;day++) { si = st.nextToken(); sale = Float.parseFloat(s1); tstore.setsaleforweekdayintersection(week, day, sale): week++; ) a1.setStores{tstore, counter); return week; 3 ) //Franchise.java public class Franchise { private Store stores[]: public Franchise(int num) { stores = new Store[num): public Store getStores(int i) { return stores: ) public void setStores(Store stores, inti) this.stores = stores:

plivale JESIES public Franchise(int num) { stores = new Store[num]; 3 public Store getStores(int i) { return stores; 3 public void setStores(Store stores, int i) { this.stores = stores; 3 public int numberofstores() { return stores.length; > ) //Store.java public class Store { private float salesbyweek00: Store salesbyweek = new float[5][7]: // getter and setters // setsaleforweekdayintersection(int week, int day, float sale) public void setsaleforweekdayintersection(int week, int day, float sale) { salesbyweek[week][day] = sale; > public void printdata for (int i = 0; i < 5; i++) for (int j = 0; i <7; i++) System.out.print(salesbyweek + "); System.out.println("");

for (int j = 0; j <7; i++) { System.out.print(salesbyweek + " "); System.out.println(""); 3 3 // float I getsalesforentireweek(int week) Il float getsaleforweekdayintersection(int week, int day) Il businessmethod Il a totalsalesforweek // b. avgsalesforweek // c. totalsalesforallweeks // d. averageweeklysales Il e. weekwithhighestsaleamt Il f. weekwithlowestsaleamt // analyzeresults /call a throughf 1/ printo Write a program that opens the following text file and processes its contents. The program should display the following per store: The total sales for each week. (Should print 5 values - one for each week). • The average daily sales for each week. (Should print 5 values - one for each week). • The total sales for all the weeks. (Should print 1 value) The average weekly sales. (Should print 1 value) The week with the highest amount in sales. (Should print 1 week #) • The week with the lowest amount in sales. (Should print 1 week #) The file contains the dollars amount of sales that a retail store made each day for a number of weeks. Each line in the file contains thirty five numbers, which are sales numbers for five weeks. The numbers are separated by space. Each line in the file represents a separate store. Please make sure that you: 1. Add a design and class diagram with your submission 里加入你想奉的内容

w punto 1 Write a program that opens the following text file and processes its contents. The program should display the following per store: • The total sales for each week. (Should print 5 values - one for each week). • The average daily sales for each week. (Should print 5 values. one for each week). • The total sales for all the weeks. (Should print 1 value) • The average weekly sales. (Should print 1 value) • The week with the highest amount in sales. (Should print 1 week #) • The week with the lowest amount in sales. (Should print 1 week #) The file contains the dollars amount of sales that a retail store made each day for a number of weeks. Each line in the file contains thirty five numbers, which are sales numbers for five weeks. The numbers are separated by space. Each line in the file represents a separate store. Please make sure that you: 1. Add a design and class diagram with your submission. 2. Add comments to your code in Filelo class. 3. Make sure you adequately test your code. 4. Provide a user-friendly interface (Conscie based) in a separate class called Uljava
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply