1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ZanzabumX [31]
3 years ago
11

A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the clie

nt, the service sold (such as Dinner, Conference, Lodging, and so on), the amount of the sale, and the date of that event. Write a java program that reads such a file and displays the total amount for each service category. Display an error if the file does not exist or the format is incorrect. Make sure the program can read a text file and that writes a separate file for each service category, containing the entries for that category. Name the output files Dinner.txt, Conference.txt, and so on.
Computers and Technology
1 answer:
Paul [167]3 years ago
7 0

Answer:

Complete solution is given below:

Explanation:

Java code:

//Header file section

import java.util.Scanner;

import java.io.*;

//main class

public class SalesTestDemo

{

//main method

public static void main(String[] args) throws IOException

{

  String inFile;

  String line;

  double total = 0;

Scanner scn = new Scanner(System.in);

//Read input file name

System.out.print("Enter input file Name: ");

inFile = scn.nextLine();

FileReader fr = new FileReader(new File(inFile));

BufferedReader br = new BufferedReader(fr);

System.out.println("Name \t\tService_Sold \tAmount \tEvent Date");

System.out.println("=====================================================");

line = br.readLine();

//Each line contains the following, separated by semicolons:

//The name of the client, the service sold

//(such as Dinner, Conference, Lodging, and so on)

while(line != null)

{

String temp[] = line.split(";");

for(int i = 0; i < temp.length; i++)

{

System.out.print(temp[i]+"\t");

if(i == 1)

System.out.print("\t");

 

}

//Calculate total amount for each service category

total += Double.parseDouble(temp[2]);

System.out.println();

line = br.readLine();

}

//Display total amount

System.out.println("\nTotal amount for each service category: "+total);

}

}

inputSale.txt:

Peter;Dinner;1500;30/03/2016

Bill;Conference;100.00;29/03/2016

Scott;Lodging;1200;29/03/2016

Output:

Enter input file Name: inputSale.txt

Name        Service_Sold    Amount    Event Date

=====================================================

Peter   Dinner       1500   30/03/2016  

Bill   Conference       100.00   29/03/2016  

Scott   Lodging       1200   29/03/2016  

Total amount for each service category: 2800.0

You might be interested in
PV = 11,000 AC = 6000 CV = 4,000. What is SV? What does this calculation tell you?
pogonyaev

Answer:

I don't see an SV in the examples.. I suspect these are the name plate numbers off of a transformer... but.. more context would really help

Explanation:

8 0
3 years ago
If we are using an 4-character password that contains only lowercase English alphabetic characters (26 different characters), ho
Trava [24]

Answer:

11,424,400 possible passwords

Explanation:

Since all characters are letters and only lowercase

we have 26∧4 = 456,976 possibilities

For a 5-character password which is still lower case sensitive.

we have 26∧5 = 11,881,376 possibilities

Many more possible passwords = (11881376-456976)

= 11,424,400 possible passwords

6 0
3 years ago
Read 2 more answers
How can i learn about networks
timama [110]

Answer:

1. Clients and servers—how services such as e-mail and web pages connect using networks.

2. IP addresses—how devices on a network can be found.

3. Network hubs, switches and cables—the hardware building blocks of any network.

4. Routers and firewalls—how to organize and control the flow of traffic on a network.

3 0
3 years ago
Your agile team only has one database developer. So the other developers finish their tasks and then wait for their work to be I
Novosadov [1.4K]

Members of an Agile development team often agrees on what tasks to work on and they do it together. The one possible solution to this challenge is to Have the database developer train the rest of the team so there are fewer handoffs.

Agile development team often works together as a team. They as team discuss the task yo take, when it will take place etc.

This team is all about communication, teamwork, problem-solving etc.

Conclusively, A task should be completed by one member on the team, but the team may choose to pair up when doing the work.

Learn more from

brainly.com/question/24383225

See full question below:

Your agile team only has one person who knows how to develop database software. So the other developers finish their tasks and then wait for their work to be Integrated into the database. This creates a pile of backed up work for the database developer. But it also means that the other developers must either wait or add to the growing pile of database work. What's one possible solution to this challenge?

Select an answer:

Have the database developer train the rest of the team so there are fewer handoffs.

Have the software developers split their time between other teams so they're not as productive

Encourage the database developer to work overtime to catch up with their work.

Create a large batch of work so the database developer can focus on finishing

8 0
2 years ago
In creating a professional action plan it's important to
blagie [28]
Whenever creating a professional action plan, it might be easier to do an "if...then..." plan, or just a daily plan, like this:

Monday:
Kitchen:
 Do dishes
 Sweep floor
 Wipe counters

Bedroom:
 do laundry etc,
5 0
3 years ago
Other questions:
  • The term integration refers to the ability to
    6·1 answer
  • What is hydraulic fracturing?
    7·1 answer
  • Paul is playing a game when his computer shuts down unexpectedly. Paul has noticed recently that his fans are running very loud.
    13·1 answer
  • Limitations of the information systems used by tesco​
    7·1 answer
  • You can minimize the Ribbon with a command contained on the _____.
    7·1 answer
  • Scenario
    7·1 answer
  • CALLING ALL DEKUS UWU
    15·2 answers
  • Leslie works in an SDLC team. When Leslie edits a file, it gets saved as an altered version. Later all the altered versions are
    9·1 answer
  • Compared with other PC operating systems, the Linux-based operating systems:
    13·1 answer
  • The designers of a database typically begin by developing a​ __________ to construct a logical representation of the database be
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!