Question

In: Computer Science

CPSC 1103 Assignment 1 Problem A cell phone provider has three different subscription packages for its...

CPSC 1103 Assignment 1 Problem A cell phone 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 $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per unlimited access is provided. Write a program to ask which package the customer has purchased, what month they are using, and how many hours were used. Determine max hours. Months with 30 days have 720 hours, and months with 31 days have 744 hours. February, with 28 days, has 672 hours. Month Days Hours January 31 744 February 28 672 March 31 744 April 30 720 May 31 744 June 30 720 July 31 744 August 31 744 September 30 720 October 31 744 November 30 720 December 31 744 Input validation: Be sure the user only selects package A, B, or C. Also, the number of hours used in a month cannot exceed maxHours (or be less than 0). Display the charge for the Package chosen. Display how much money Package A customers would save if they purchased packages B or C; how much money Package B customers would save if they purchased packages A or C; and how many packages C customers would save if they purchased packages A or B. If there would be no savings, no message should be printed. What to hand in: Please see the title page for requirements for assignments. You need the following in a single Word document: • Source code listing fully documented (comments for purpose, file, programmer, all variable declarations, and major tasks). • Test runs to show valid and invalid data as well as savings. • User Guide with Purpose stated for a User, a simple run to illustrate the capability of the program and a section for assumptions and limitations • A hierarchy chart for example to calculate the area of a rectangle

Solutions

Expert Solution

An Internet service provider has three different subscription packages
* for its customers.
*
*        Package A:   For $9.95 per month 10 hours of access 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 hours.
*
*        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.
*/
import java.util.Scanner;


public class InternetServiceProvider {
   public static void main (String args[])
   {
       while (true)
       {
           printMonthlyBill(calculateBill(getHours(), menu()));
       }
   }
  
   public static double getHours()
   {
       double hours;
      
       Scanner inputHours = new Scanner (System.in);
      
       System.out.print("Please enter the hours used: ");
       hours = inputHours.nextDouble();
      
       inputHours.close();
      
       return hours;
   }
  
   public static int menu ()
   {
       int packageChoice;
      
       Scanner userInput = new Scanner (System.in);
      
       System.out.println("[1] Package A");
       System.out.println("[2] Package B");
       System.out.println("[3] Package C");
       System.out.print("Please select your package: ");
       packageChoice = userInput.nextInt();
       userInput.close();
      
       return packageChoice;
   }
  
   public static double calculateBill(double hours, int packageChoice)
   {
       switch (packageChoice)
       {
           case 1:
               if (hours < 10)
               {
                   return 9.95;
               }
              
               else
               {
                   return (hours - 10)*2 + 9.95;
               }
              
           case 2:
               if (hours < 20)
               {
                   return 13.95;
               }
              
               else
               {
                   return (hours - 20) + 13.95;
               }          
           case 3:
               return 19.95;
              
           default:
               System.out.println("Invalid input!");
               return 0;
       }
   }
  
   public static void printMonthlyBill(double bill)
   {  
       System.out.println("Your monthy bill is $" + bill);
   }
}


Related Solutions

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....
Assume you are a senior manager of a cell phone provider such as TELUS, Rogers or...
Assume you are a senior manager of a cell phone provider such as TELUS, Rogers or Bell. How might your (cell phone provider) costs of production be affected in the short-run and long-run? (approx. 230 words)
The quality control manager of a major cell phone provider is concerned about the life of...
The quality control manager of a major cell phone provider is concerned about the life of the cell phone batteries they use. He took a sample of 13 batteries from a recent shipment and used them continuously until they failed to work. The manager measured the number of hours the batteries lasted and found the mean to be 550.4 with a standard deviation of 315.3. What is the critical value for α = .10 to test the claim that the...
4) You are hired by a cell phone provider to determine the number of times per...
4) You are hired by a cell phone provider to determine the number of times per day their customers interact with their smartphone. You take a random sample of 25 customers and find the average number of interactions to be 75 times per day with a sample standard deviation of 5. 4 a. If you decide to construct a confidence interval for the population mean number of interactions, what distribution would you use and why? ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ b. Construct...
4) You are hired by a cell phone provider to determine the number of times per...
4) You are hired by a cell phone provider to determine the number of times per day their customers interact with their smartphone. You take a random sample of 25 customers and find the average number of interactions to be 75 times per day with a sample standard deviation of 5. 4 a. If you decide to construct a confidence interval for the population mean number of interactions, what distribution would you use and why? ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ b. Construct...
A friend or yours is considering two cell phone service providers. Provider A charges $100 per...
A friend of yours is considering two cell phone service providers. Provider A charges $100 per month for the service regardless of the number of phone calls made. Provider B does not have a fixed service ree but instead charges $1 per minute for calls. Your friend's monthly demand for minutes or calling is given by the equation p-120-30P, where P is the price of a minute.  With Provider A, the cost of an extra minute is 5 _______ .with...
1. If the number of arrivals at a cell phone kiosk has a rate of 0.80...
1. If the number of arrivals at a cell phone kiosk has a rate of 0.80 customers per hour. to. What is the probability that less than 2 clients arrive in the next half hour? (10 points) b. What is the probability that in the next three hours between 2 and 4 clients will arrive inclusive? (10 points) c. Last customer arrived at 2:00 pm, what is the probability that the next customer takes more than 60 minutes to arrive?...
PRACTICE PROBLEM Samsung has decided to manufacture a special edition cell phone called HiRide for the...
PRACTICE PROBLEM Samsung has decided to manufacture a special edition cell phone called HiRide for the teen market next year that will be sold only with T-Mobile’s wireless service. Let’s assume that for this design Samsung’s manufacturing costs are $31 per phone, their fixed manufacturing costs are about $2,000,000, and their advertising and promotional costs are expected to be about $1,000,000. Samsung will make this phone exclusive to T-Mobile, who will feature it in their retail stores for sale to...
The Phone Company has the following costs of producing and selling a cell phone when it...
The Phone Company has the following costs of producing and selling a cell phone when it produces and sells 100,000 cell phones per month: Per unit manufacturing cost             Direct materials                                              $60.00             Direct labor                                                     10.00             Variable manufacturing overhead cost             35.00             Fixed manufacturing overhead cost                 20.00 Per unit selling cost             Variable                                                          20.00             Fixed                                                               10.00 Note that ‘100,000’ is the denominator used to calculate fixed costs per unit. Total fixed costs...
Research and write a short paper (two pages maximum) about your Canadian cell phone provider. What...
Research and write a short paper (two pages maximum) about your Canadian cell phone provider. What are its mission, strategy, and competitive priorities? How is sustainability incorporated into its strategy, value chain, and operations? The answere should be in Canadian Network Provider Choose Any Rogers Bell Telus Freedom Fido
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT