subject

Write a program that opens the salesdat. txt file and processes it 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 number are separated by space. Each line in the file represents a separate store.
//FileIO. java
import java. io. BufferedReader;
import java. io. FileReader;
import java. io. IOException;
public class FileIO {
//Franchise readData(String filename)
public static void main(String[] args) {
try {
FileReader file = new FileReader("Salesdat. txt");
BufferedReader buff = new BufferedReader(file);
boolean eof = false;
while (!eof) {
String line = buff. readLine();
if (line == null)
eof = true;
else
System. out. println(line);
}
buff. close();
} catch (IOException e) {
System. out. println("Error -- " + e. toString());
}
}
}
//Store. java
public class Store {
private float salesbyweek[][];
Store() {
salesbyweek = new float[5][7];
}
//getter and setters
//(int week, int day, float sale)
public void (int week, int day, float sale){
salesbyweek[week][day]=sale;
}
//float [] getsalesforentireweek(int week)
//float (int week, int day)
//businessmethod
//a. totalsalesforweek
//b. avgsalesforweek
//c. totalsalesforallweeks
//d. averageweeklysales
//e. weekwithhighestsaleamt
//f. weekwithlowestsaleamt
//analyzeresults //call a through f
//print()
}
//Franchise. java
public class Franchise {
private Store stores[];
public Franchise(int num) {
stores = new Store[num];
}
public Store getStores(int i) {
return stores[i];
}
public void setStores(Store stores, int i) {
this. stores[i] = stores;
}
}
//Driver. java
public class Driver {
public static void main(String[] args) {
}
}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:30, noah2o2o
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 2
image
Computers and Technology, 24.06.2019 22:10, gabriellabadon2
In command prompt, whats a command that will list only .ini files in c: \windows\system32 directory?
Answers: 1
image
Computers and Technology, 25.06.2019 04:40, hazeleyes2006
Ineed ! i need a computer whiz to me complete my study guide on computers, it's 50 questions. if anyone can me i'll be greatly appreciated.
Answers: 1
image
Computers and Technology, 25.06.2019 10:20, lydialinton23
Write a program that lets the user play the game of rock, paper, scissors against the computer. the program should work as follows. 1. when the program begins, a random number in the range of 1 through 3 is generated. if the number is 1, then the computer has chosen rock. if the number is 2, then the computer has chosen paper. if the number is 3, then the computer has chosen scissors. (don’t display the computer’s choice yet.) 2. the user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard. (you can use a menu if you prefer.) 3. the computer’s choice is displayed. 4. a winner is selected according to the following rules: • if one player chooses rock and the other player chooses scissors, then rock wins. (the rock breaks the scissors.) • if one player chooses scissors and the other player chooses paper, then scissors wins. (scissors cuts paper.) • if one player chooses paper and the other player chooses rock, then paper wins. (paper wraps rock.) • if both players make the same choice, the game must be played again to determine the winner. be sure to divide the program into functions that perform each major task. include the code and the console output from running your program with test inputs in your report.
Answers: 3
You know the right answer?
Write a program that opens the salesdat. txt file and processes it contents. The program should disp...

Questions in other subjects:

Konu
Mathematics, 22.10.2020 03:01
Konu
History, 22.10.2020 03:01
Konu
Computers and Technology, 22.10.2020 03:01
Konu
Mathematics, 22.10.2020 03:01