Question

In: Computer Science

wirte a program in java Part I     Internet Service Provider An Internet service provider has three...

wirte a program in java

Part I     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 $13.95 per month 20 hours of access are provided. Additional hours

are $1.00 per hour.

Package C: For $19.95 per 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.

Part 2   Internet Service Provider

Modify the program you wrote for Programming in part 1 so it also calculates and

displays the amount of money Package A customers would save if they purchased Package

B or C, and the amount of money Package B customers would save if they purchased Package If there would be no savings, no message should be printed.

use printf for output and no arrays

Solutions

Expert Solution

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

import java.util.Scanner;

public class ServiceCalculator {
   public static void main(String[] args) {

       // scanner to read data from user
       Scanner sc = new Scanner(System.in);
       char Package;
       double hoursUsed;
       double monthlyBill = 0;
       // starting infinite loop to get valid inputs from user
       while (true) {

           // reading type of package from user
           System.out.print("Enter Package (A/B/C) :");
           Package = sc.next().charAt(0);
           // reading data from user
           System.out.print("Enter number of hours used :");
           hoursUsed = sc.nextDouble();
           // checking if inputs are valid than comes out of the loop
           if ((Package == 'A' || Package == 'B' || Package == 'C') && (hoursUsed >= 0 && hoursUsed <= 50)) {
               break;
           } else {
               System.out.println("\nInvalid Input\n\nEnter the details again\n--------------------");
           }
       }
       // starting to switch to calculate based user selected package
       switch (Package) {
       // if selected type is A
       case 'A':
           // checking if user used less than 5 GB else calculating additional charges
           if (hoursUsed <= 10) {
               monthlyBill = 9.95;
           } else {
               monthlyBill = 9.95 + ((hoursUsed -10) * 2);
           }
           break;
       case 'B':
           // checking if user used less than 10 GB else calculating additional charges
           if (hoursUsed <= 10) {
               monthlyBill = 13.95;
           } else {
               monthlyBill = 13.95 + ((hoursUsed - 20) * 1);
           }
           break;
       case 'C':
           monthlyBill = 19.95;
           break;
       }
       System.out.printf("\nMonthly bill = $%.2f\n", monthlyBill);
       // based on usage suggesting Package type for user
      
   }
}

2)


import java.io.*;
import java.util.Scanner;
import java.text.DecimalFormat;

class InternetProviderPart2
{
public static void main(String[] args)
{
int hours;
double packageA_amount,
packageB_amount,packageC_amount;
double total_amount=0;
DecimalFormat formatter =
new DecimalFormat(" 0.00");

Scanner keyboard = new Scanner(System.in);


System.out.println("Enter hours:");
hours=keyboard.nextInt();



if(hours<10)
packageA_amount=9.95;
else
packageA_amount=9.95+((hours-10)*2);

if(hours<20)
packageB_amount=14.95;
else
packageB_amount=14.95+((hours-20)*1);

packageC_amount=19.95;

double difference;
difference=packageA_amount- packageB_amount;
System.out.println("Package A customer would save $"
+formatter.format(difference)+ " than Package B");
difference=packageA_amount - packageC_amount;
System.out.println("Package A customer would save $"
+formatter.format(difference)+ " than Package C");
difference=packageB_amount - packageC_amount;
System.out.println("Package B customer would save $"
+formatter.format(difference)+ " than Package C");

System.exit(0);
}
}

Kindly revert for any queries

Thanks.


Related Solutions

An internet service provider​ (ISP) has experienced rapid growth in the past five years. As part...
An internet service provider​ (ISP) has experienced rapid growth in the past five years. As part of its marketing​ strategy, the company promises fast connections and dependable service. To achieve its​ objectives, the company constantly evaluates the capacity of its servers. One component of its evaluating is an analysis of the average amount of time a customer is connected and actively using the Internet daily. A random sample of 12 customer records shows the following daily usage​ times, in minutes....
An Internet service provider has three different subscription packages for its customers: Package A: $9.95 per...
An Internet service provider has three different subscription packages for its customers: Package A: $9.95 per month 10 hours of access are provided.   Additional hours are $2.00 per hour. Package B: $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: $19.95 per month unlimited access is provided. Write a MATLAB script to calculates a customer’s monthly bill. It should ask which package the customer has purchased and how many hours were used....
Internet service: An Internet service provider sampled 530 customers, and finds that 70 of them experienced...
Internet service: An Internet service provider sampled 530 customers, and finds that 70 of them experienced an interruption in high-speed service during the previous month. (b) Construct a 90% confidence interval for the proportion of all customers who experienced an interruption. Round the answers to at least three decimal places.
Internet service: An Internet service provider sampled 545 customers, and finds that 65 of them experienced...
Internet service: An Internet service provider sampled 545 customers, and finds that 65 of them experienced an interruption in high-speed service during the previous month. (b) Construct a 99.8% confidence interval for the proportion of all customers who experienced an interruption. Round the answers to at least three decimal places. A 99.8% confidence interval for the proportion of all customers who experienced an interruption is _<p<_.
Imagine you are consulting for an Internet service provider (ISP) that has hired you to research...
Imagine you are consulting for an Internet service provider (ISP) that has hired you to research the impact of customer retention on their bottom line. Assume that their current monthly turnover is 3%, they have 1000 subscribers, they have set monthly subscriber fees at $25, and they estimate that their cost to serve customers is $10. Further, while they report that they do not have an estimate for customer acquisition cost, you do a little number crunching and find that...
The average time taken for your Internet service provider to remotely resolve a trouble ticket has...
The average time taken for your Internet service provider to remotely resolve a trouble ticket has a Normal distribution with a mean of 4.3 hours and a standard deviation of 3.1 hours. One day your service provider selects 100 trouble ticket. What is a probability that an average time to resolved these 100 tickets will be less than 4 hrs?
Define Internet, Web, HTML, Javascript, Web Page, Ecommerce, and Internet Service Provider ISP) in your own...
Define Internet, Web, HTML, Javascript, Web Page, Ecommerce, and Internet Service Provider ISP) in your own words in one essay.
En-range Networks is a startup internet service provider in Japan that is aiming to provide faster...
En-range Networks is a startup internet service provider in Japan that is aiming to provide faster internet access to Japanese citizens. The company has recently finished installing its main access node just south of Tokyo and has hired you to conduct speed tests and analyze the results. To get some intial data, you decide to conduct latency tests from the newly completed node to random servers around the world. Your tests yield the following data: Test 1 2 3 4...
In java program format Submit your completed UML class diagram and Java file. Part I: Create...
In java program format Submit your completed UML class diagram and Java file. Part I: Create a UML diagram for this assignment PartII: Create a program that implements a class called  Dog that contains instance data that represent the dog's name and age.   define the Dog constructor to accept and initialize instance data.   create a method to compute and return the age of the dog in "person-years" (note: dog age in person-years is seven times a dog's age).   Include a toString...
In java program format Submit your completed UML class diagram and Java file. Part I: Create...
In java program format Submit your completed UML class diagram and Java file. Part I: Create a UML diagram for this assignment PartII: Create a program that implements a class called Dog that contains instance data that represent the dog's name and age. define the Dog constructor to accept and initialize instance data. create a method to compute and return the age of the dog in "person-years" (note: dog age in person-years is seven times a dog's age). Include a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT