answer.
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
zepelin [54]
1 year ago
7

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 ( Dinner, Conference, Lodging) the amount of the sale the date of the event. Write a program that reads such a file and displays the total amount of each service category. Display an error if the file does not exist or the format is incorrect. Homework
Computers and Technology
1 answer:
timama [110]1 year ago
3 0

Answer:

see explaination

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
Escribe, en los siguientes cuadros, los conceptos que correspondan
Fofino [41]

Answer:

Débito o debe                                                         Crédito o haber

Préstamo de la cooperativa                                          Efectivo

Gasto de arriendo                                              Cuentas por cobrar

Cuentas por pagar                                          Documentos por cobrar

Gasto de publicidad                                                Capital social

Hipoteca por pagar                                                       Ventas

Intereses pagados            Bancos (en el caso de cobros a través de bancos)

Bancos (en el caso que deba productos bancarios)

Explanation:

3 0
2 years ago
Dante wants to calculate the currently monthly subtotals for the sales of golf balls in his store. Which of the following will h
cupoosta [38]
I believe the answer is B
3 0
2 years ago
c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
Lilit [14]

The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.

#include<stdio.h>

#include<string.h>

 int* uniqueValue(int input1,int input2[])

 {

   int left, current;

   static int arr[4] = {0};

   int i      = 0;

     for(i=0;i<input1;i++)

      {

         current = input2[i];

         left    = 0;

         if(current > 0)

         left    = arr[(current-1)];

      if(left == 0 && arr[current] == 0)

       {

       arr[current] = input1-current;

       }

       else

   {

       for(int j=(i+1);j<input1;j++)

       {

           if(arr[j] == 0)

           {

               left = arr[(j-1)];

               arr[j] = left - 1;

           }

       }

   }

}

return arr;

}

4 0
2 years ago
In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
devlian [24]

Answer:

// here is code in java.

import java.util.*;

// class definition

class Main

{

// method that return total fare

   public static double fare(double dis)

   {

   // calculate the total fare

       double tot_fare=(4+((dis*1000)/140)*0.25);

       return the fare

       return tot_fare;

   

   }

   //driver method

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read input string

       Scanner s=new Scanner(System.in);

        // variable

       double dis;

       System.out.print("please enter the distance in KM: ");

       //read the number

       dis=s.nextDouble();

       

       // call the function with "dis" parameter

     double ride_fare=fare(dis);

     // print the total fare

     System.out.println("total fare is: "+ride_fare);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the distance from user with the help of scanner class.Call the function with parameter "dis".Here it will calculate the total fare as (4+((dis*1000)/140)*0.25). Here base fare is $4 and $0.25 for every 140 meter.Then function will return the total fare.

Output:

please enter the distance in KM: 7                                                                                                                            

total fare is: 16.5  

7 0
1 year ago
You are a network administrator for a large bagel manufacturer that has 32 bakeries located throughout the United States, United
Anni [7]

Answer:

See the components in explaination

Explanation:

In order to make it as IPv6, few key components should be supported, those components are given below:

The infrastructure must support the enhanced protocol StateLess Address Auto-Configuration (SLAAC).

Static addressing with DHCPv6, dynamic addressing with DHCPv6 and SLAAC are the methods used to configure the IPv6. The network administrator should able to understand and implement the IPv6 through the DHCPv6.

Other than the implementation, working of IPv4 and IPv6 are same. Therefore, the administrator need not to learn new information for its working.

As the IPv6 address length is 128-bit and purpose is for everything on line to have an IP address. It must allow the internet to expand faster devices to get internet access quickly.

The DHCPv6 is not supported by all windows. Therefore, network administrator should check the corresponding Operating system (OS) would support the DHCPv6 for IPv6.

The network administrator must have good knowledge and skills on the IPv6.

The above mentioned key components should be verified by the network administrator in order to support for IPv6 project with DHCPv6.

4 0
1 year ago
Other questions:
  • Janice is unsure about her future career path she has grown up on her family farm but she is also interested in medicine Janice
    5·1 answer
  • To open the format cells dialog box with the alignment sheet active, tap or click the alignment settings ____.
    8·1 answer
  • Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that adds 1 to d
    13·1 answer
  • Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, if
    13·1 answer
  • Suppose that each row of an n×n array A consists of 1’s and 0’s such that, in any row i of A, all the 1’s come before any 0’s in
    15·1 answer
  • A computer with a 240-watt power supply is connected to a 120 V circuit and is left on continuously for one month (31 days). How
    9·1 answer
  • Read the four detective reports and the combined affidavit and warrant for the M57 Patents case. Write a one- to two-page paper
    5·1 answer
  • A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (1) Ou
    15·1 answer
  • Nstructions
    7·1 answer
  • A drive is small enough to be carried in one's pocket.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!