Description
❐Part 1: BMI History Pro [18 points]
1. Prompt our user to enter his/her height in feet and inches (two integers). 2. Prompt our user to enter his/her lowest weight in pounds (an integer). 3. Prompt our user to enter his/her heaviest weight in pounds (an integer). 4. Print a table of Body Mass Index (BMI) for the height entered: a) Weights range from the low weight to the high weight, at increments of 5 pounds.
▪ This means to get more than 1 line low weight and high weight should have more than 5 pounds of difference ▪ To get additional decimals behind decimal point, you may want to cast one of the variables into a float or a double ▪ prompt user twice int user2 = scan.nextInt()// feet ▪ int user3 = scan.nextInt()// inches ▪ 703 * weight( height * height) // height is in inches Math.pow(heigh, 2) b) Each row of the table lists ▪ The value of WEIGHT (an integer), followed by spaces, then ▪ The value of BMI to four decimal places (a float), followed by spaces, then
▪ The CONDITION whether overweight (BMI > 25), or not overweight (BMI <= 25). 5. Document our code carefully. Our program output must be identical to the sample output (except author name). OUTPUT OF SAMPLE RUN FOR PART 1
for (… System.out.print(“^”); } System.out.print(“^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^”); SUBMISSION INSTRUCTIONS 1. Submit the 1 TableBmi.java file directly on iLearn 2. Take a screenshot of the output of your program and paste it here Output :
❐Part 2: BMI Code Reuse [10 points]
1. So far, we have written 2 versions of the BMI program, BMI Standard version from assignment 1 and BMI History Pro version from this Assignment 2, part 1. Reusing the programs, please make our BMI offer users to choose which version they want to use. (After users make their choice, they should be able to use the program they chose.) 2. Document our code carefully using the provided guidelines. Include screenshots and notes in our report. OUTPUT OF SAMPLE RUNS FOR PART 2
1. Submit the 1 TableBmiPro.java file directly on iLearn 2. Take a screenshot of the output of your program for option 1 and option 2 and paste it here
Output for Option 1 :
Output for Option 2:
❐Part 3: Your own idea [10 points]
It can be similar to part 1 or 2. Please use what you learned from Loops. a. In Assignment 1, Part 3 and in Assignment 2, Part 2: Your own idea, you created your own idea of a program. For this assignment, you must improve upon your first program by adding what you learned from Loops b. Must include Loops, using either “for”, or “while” or “do while” c. And, must use the loop to output more than 1 line of result d. Must provide an explanation to the user of your idea “This program will help you… ” (2 points) FILE NAME REQUIREMENTS .Java
SUBMISSION INSTRUCTIONS
1. Submit the 1 .Java file directly on iLearn 2. Take a screenshot of the output of your program run for all conditions and paste it here Explanation: This program calculates the compound interest rate and displays the generated interests and the cumulative balances as a table. The execution loop is as follows: ● The user enters the required parameters to calculate the periodic compounding interest. These are: ○ the principal deposit amount, ○ the compounding frequency, ○ the nominal annual interest rate, and ○ the deposit term.
● The program prints and re-summarizes these parameters to the user. ● The program will determine whether to display a yearly or a quarterly report. This depends on the deposit term length. ● These parameters are then used to calculate the interests generated and subsequently, the new balance for each period.
○ These results are printed in each row. Each row will present the following information: ■ the deposit length, ■ the interest generated at that period, ■ the cumulative interest generated, ■ and the new principal balance at that period ○ Depending on the deposit term length, the number of rows may vary. For example: ■ a yearly report for a six-year term deposit will output seven rows, one row for each year, with the first row at year 0 ■ a quarterly report for a two-year deposit will output nine rows, one row for each quarter, with the first row at year 0
● After the table is displayed, the user is then presented with a summary, presenting: ○ their original principal sum (what they started with) ○ the total generated interest (how much they made) ○ and their final balance (the total at the end) There are infinite possible outcomes for this program. However, there are two main ways the output may differ: the report may be on a quarterly or yearly basis. The program will generate a quarterly report if the deposit term is 2 years or less (a yearly report for a oneor two-year deposit would be pretty useless).
Otherwise, it will generate a yearly report. Note on output formatting ● “Year 0” ○ The table starts at year 0 deliberately in order to illustrate the starting point of the deposit. This is meant to contrast the starting interest and how it increases over the period. ● Deposit length column decimal years ○ The years are formatted to contain two decimal points for quarterly reports. ● Rounding ○ All dollar amounts are rounded to the nearest cent. The two example cases are on the following pages.
Example 1: The user inputs a deposit term that is twelve years. The program will output a yearly report displaying the interests and principal balance at the end of each period.
Example 2: The user inputs a deposit term that is two years. The program will output a quarterly report displaying the interests and principal balance at the end of each period. What a rate!
❐Part 4: Comment your code [2 points]
Every Java file you write in this assignment will require you to include descriptive comments. In this assignment, you are tasked with writing a descriptive 1. Headers 2. Comments You can write comments in two ways: • Single-line comments using the // notation. • Multi-line comments using the /* and */ notation. a. Include a proper header at the top of every Java file. Figure 1 Header Format /* * Assignment * Description: * Name: * ID: * Class: CSC 210-