CSC 1302 Principles of Computer Science II Lab 2: Loop, Conditional and Method Practice Solved

34.99 $

Description

5/5 - (1 vote)

Purpose:
Task1:
Suppose● When𝑛 is the last-two digits of the PantherID,is odd, please calculate: 𝑚 = 𝑛 + 5.
1) 𝑚
2) /1 + 1/3 + 1/5 + … + 1/𝑚 = ?
● When1/3 +is even, please calculate: 1/7 + 1/11 + . + 1/(2 * 𝑚 + 1) = ?

Task2:
Write a java program named BMI.java
(i) print out your name and your pantherID
(ii) Ask user to type in his/her weight and height; if an illegal input (such as a letter) is typed by the user, give the user one more chance to input correctly.
(iii) Create a method to compute the body mass index (BMI) accordingly. BMI=weight/(height*height) * 703
(iv) Print out the weight class according to the right table.
BMI Weight class
below 18.5 underweight
18.5 – 24.9 normal
25.0 – 29.9 overweight
30.0 and up obese
Criteria:
1. Upload all of the .java and the .class files to the CSc1302 dropbox on http:// icollege.gsu.edu.
3. Please comment the important lines in the .java file as shown in the template. The important lines including but not limited to i) variables, ii) for-loop, iii) while-loop, iv) if-else statement, iv) methods. Please use your own words to describe what is your purpose to write this line. A .java file without comment will be graded under a 40% penalty.
4. Make sure that both the .java and .class files are named and uploaded to icollege correctly. If any special package is used in the program, be sure to upload the package too. Should you use any other subdirectory (whatsoever) your program would not be graded, and you will receive a 0 (zero).
5. No copying allowed. If it is found that students copy from each other, all of these programs will get 0.

  • lab-02-pph9lb.zip