Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An Internet service provider at an expensive hotel has 3 different subscription

ID: 665143 • Letter: A

Question

An Internet service provider at an expensive hotel has 3 different subscription packages for its customer:
Package A: For $9.95 a month 10 hours of access are provided. Additional hours are $2.00 per hour.
Package B: For $13.95 a month 20 hours of access are provided. Additional hours are $1.00 per hour.

Package C: For $19.95 a month unlimited access is provided.
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. It should then display the total charges.
Input validation: The package has to be either A, B, or C. Reject other inputs. The number of hours must be greater than 0.
Writing a program in Java. An Internet service provider at an expensive hotel has 3 different subscription packages for its customer:
Package A: For $9.95 a month 10 hours of access are provided. Additional hours are $2.00 per hour.
Package B: For $13.95 a month 20 hours of access are provided. Additional hours are $1.00 per hour.

Package C: For $19.95 a month unlimited access is provided.
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. It should then display the total charges.
Input validation: The package has to be either A, B, or C. Reject other inputs. The number of hours must be greater than 0.
Writing a program in Java.
Package A: For $9.95 a month 10 hours of access are provided. Additional hours are $2.00 per hour.
Package B: For $13.95 a month 20 hours of access are provided. Additional hours are $1.00 per hour.

Package C: For $19.95 a month unlimited access is provided.
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. It should then display the total charges.
Input validation: The package has to be either A, B, or C. Reject other inputs. The number of hours must be greater than 0.
Writing a program in Java.

Explanation / Answer

working java code

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
   public static void main (String[] args) throws java.lang.Exception
   {
       // your code goes here
       int hours;
       double bill;
       Scanner sc=new Scanner(System.in);
       hours = sc.nextInt();
       char c = (char) System.in.read();
       if (c=='A')
       {
           if (hours < 10)
           bill=9.95;
           else
           {
               bill=(9.95) + ((hours-10)*2);
           }
                       System.out.println("bill is" + bill);

       }
       else if (c=='B')
       {
           if (hours < 20)
           bill=13.95;
           else
           {
               bill=(13.95) + ((hours-20)*1);
           }
           System.out.println("bill is" + bill);
       }
       else if (c=='C')
       {
           bill = 19.95;
           System.out.println("bill is" + bill);

       }
       else
       {
           System.out.println("Invalid input");
       }
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote