computer science

posted by .

write a program that calculates a customer's monthly bill. it should input customer name, which package the customer has purchased, and how many hours were used. it should then create a bill that includes the input informtion and the total amount due. the bill should be written to a file.

in C++

  • computer science -

    What have you done so far?

  • computer science -

    i dnt have anything. im totally lost

  • computer science -

    We can help you review what you have done, in terms of programming problems, pseudocodes, debugging, etc.

    You must have gone through a good part of the course, and it is time to apply what you have learned.

    Post what you can do or have done and get the project started.

  • computer science -

    import java.util.Scanner;
    import java.text.DecimalFormat;
    public class Bill{
    public static void main(String[] args){
    String input;
    char servicePackage;
    int hours=0;
    int extrahours=0;
    double charges=0.0;
    int totalHours = 0;
    final double BASE_RATE_A = 9.95;
    final double BASE_RATE_B = 13.95;
    final double BASE_RATE_C = 19.95;
    final int BASE_HOUR_A = 10;
    final int BASE_HOUR_B = 20;
    final double PER_HOUR_A = 2.00;
    final double PER_HOUR_B = 1.00;

    Scanner kb = new Scanner(System.in);
    DecimalFormat fmt = new DecimalFormat("$##.00");

    System.out.print("Service package (A, B, or C): ");
    input = kb.nextLine();
    servicePackage = input.charAt(0);


    if(servicePackage == 'A'){
    System.out.print("Number of hours: ");
    hours = kb.nextInt();
    if(hours<=10){
    charges = BASE_RATE_A;
    System.out.println("Total Charges: "+fmt.format(charges));
    }
    else{
    extrahours=hours-BASE_HOUR_A;
    charges = BASE_RATE_A +(extrahours*PER_HOUR_A);
    System.out.println("Total Charges: "+fmt.format(charges));
    }
    }
    else if(servicePackage == 'B'){
    System.out.print("Number of hours: ");
    hours = kb.nextInt();
    if(hours<=20){
    charges = BASE_RATE_B;
    System.out.println("Total Charges: "+fmt.format(charges));
    }
    else{
    extrahours=hours-BASE_HOUR_B;
    charges = BASE_RATE_B+(extrahours*PER_HOUR_B);
    System.out.println("Total Charges: "+fmt.format(charges));
    }

    }
    else if(servicePackage == 'C'){
    System.out.print("Number of hours: ");
    hours = kb.nextInt();
    charges = BASE_RATE_C;
    System.out.println("Total Charges: "+fmt.format(charges));
    }

    }
    }

  • computer science -

    Good work!

    Usually customer like to know how the charges are broken down into fixed charges, rate, and number of hours, similar to your electricity bill. So you should include the input information as requested by the question.

    You'll still need to write the bill to a file.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. computer science

    I need help with my Java homework! Write a program that calculates a customer's monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were used. …
  2. Progamming

    This is the Problem, I just want to get a little help on this problem. Suppose automile repair customers are billed at the rate of $35 per hour for labor. Also, costs for parts and supplies are subject to a 5% sales tax. Write a program …
  3. Marketing

    Net-4-You is an internet service provider that charges its 1 million customers $19.95 per month for its service. The company's variable cost are $0.50 per customer per month. In addition, the company spends $0.50 per month per customer, …
  4. math

    Power companies typically bill customers based on the number of kilowatt-hours used during a single billing period. A kilowatt is a measure of how much power (energy) a customer is using, while a kilowatt-hour is one kilowatt of power …
  5. programming logic

    The No Interest Credit Company provides zero-interest loans to customers. (It makes a profi t by selling advertising space in its monthly statements and selling its customer lists.) Design an application that gets customer account …
  6. computers

    Th e No Interest Credit Company provides zero-interest loans to customers. Design an application that gets customer account data, including an account number, customer name, and balance due. Output the account number and name, then …
  7. IT

    The No Interest Credit Company provides zero-interest loans to customers. Design an application that gets customer account data, including an account number, customer name, and balance due. Output the account number and name, then …
  8. intro to computer programming

    I need help with my Java homework! Write a program that calculates a customer's monthly bill. It should ask the user via dialog box to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours …
  9. computer science

    An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For $13.95 per month 20 hours …
  10. computer science

    Internet Service Provider An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For …

More Similar Questions