CS 1A Assignment #4 Fall 2016 October 18, 2016 __________________________________________________________________________________ Programming...

CS 1A Assignment # 4 Fall 2016 October 18 , 2016 _________________________________________________________ _________________________ Programming Assignment 4 (30 points) Due date: October 27 , 201 6 at 11:5 9 PM Assignment Overview This assignment will give you pra ctice with interactive programs and if/else statements . Part 1: User name Generator [10 points] Write a program that prompts for and reads the user’s first and last name (separately). Then print a string composed of the first letter of the user’s first name, followed by the first five chara cters of the user’s last name, followed by a random number in the range 10 to 99. Assume that the last name is at least five letters long. Similar algorithms are sometimes used to generate user - names for new computer accounts. CLASS NAME . Your program class should be called UserNameGenerator.java . Sample run: Enter your first name: William Enter your last name: Henry Username: WHenry 88 Part 2 : Internet Service Provider [20 points] 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. CLASS NAME . Your program class should be called InternetService Provider .java. Sample run 1: Enter the customer's package (A, B, or C): A Enter the number of hours used: 50 The charges are $89.95 Sample run 2: Enter the customer's package (A, B, or C): C Enter the number of hours used: 100 The charges are $19.95 Sample run 3: Enter the customer's package (A, B, or C): D Invalid package. Ent er A, B, or C. Sample run 4: Enter the customer's package (A, B, or C): B Enter the number of hours used : 150 The charges are $144.95 CS 1A Assignment # 4 Fall 2016 October 18 , 2016 _________________________________________________________ _________________________ Rules :  For this assignment you are limited to the language features in Chapters 1 through 4 ; you are not allowed to use more advanced features to solve the problem. Please do not use Java features that are not covered in lecture or the textbook.  Use class constants as appropriate to represent important fixed data values in your program.  You are required to properly indent your code and will lose points if you make significa nt indentati on mistakes. You should also use whitespace properly to make your program more readable, such as between operators and their operands, between parameters, and blank lines between groups of statements or methods.  Java's naming standards about the format of ClassNames, VariableNames, and CONSTANT_NAMES.  Include a comment at the beginning of your program with basi c information.  You should use at least one switch statement or at least one multi -way if -statement (using "else if").  Much of your code will involve conditional execution with if and if/else statements. Part of your grade will come from using these st atements appropriately.  Notice that all real numbers output by the program are printed with no more than 2 digits after the decimal point. To achieve this, you may use the System.out.printf method as follows. // print exam score, rounded to 2 decimal places Sy stem.out.printf("%.2f", ExamScore); Submission Instructions  Execute the program and copy/paste the output that is produced by your program into the bottom of the source code file, making it into a comment. I will run the programs myself to see the output.  Make sure the run "matches" your source. If the run you submit could not have come from the source you submit, it will be graded as if you did not hand in a run.  Use the Assignment Submission link to submit the source code file.  Submit the following files: o UserNameGenerator.java o InternetService Provider .java  Do not submit .class files. Standard program header Each programming assignment should have the following header, with italicized text, appropriately replaced. /* * Class: CS1A * Description: (Give a brief description of Assignment 4) * Due date: 10/ 27 /2016 * Name: (your name) * File name: UserNameGenerator.java */