Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Overview This assignment will give you practice with interactive programs and if/else statements. Part 1: User name Generator Write a program that prompts for

Assignment Overview This assignment will give you practice with interactive programs and if/else statements.

Part 1: User name Generator Write a program that prompts for and reads the users first and last name (separately). Then print a string composed of the first letter of the users first name, followed by the first five characters of the users 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 usernames 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: WHenry88 Part 2: Bank Charges [20 points] A bank charges a base fee of $10 per month, plus the following check fees for a commercial checking account:

$.10 each for less than 20 checks

$.08 each for 2039 checks

$.06 each for 4059 checks

$.04 each for 60 or more checks

Write a program that asks for the number of checks written for the month. The program should then calculate and display the banks service fees for the month. CLASS NAME. Your program class should be called BankCharges.java. Sample run 1: Enter the number of checks written this month: 30 The total fees are $12.40 Sample run 2: Enter the number of checks written this month: 30 The total fees are $12.40

Sample run 3: Enter the number of checks written this month: 45 The total fees are $12.70

Sample run 4: Enter the number of checks written this month: 70 The total fees are $12.80 ______________________________________________________________

Rules:

For this assignment you are limited to the language features in Chapters 1 through 4; you are not allowed. (The text is Intro to Java 10th edition Y. Liang) 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 significant indentation 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 basic 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 statements 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 System.out.printf("%.2f", ExamScore);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

Question What is a secular trust?

Answered: 1 week ago