[Solved] NCCU-ProgrammingLanguage1- Assignment 2-yourStudentId

$25

File Name: NCCU_ProgrammingLanguage1__Assignment_2_yourStudentId.zip
File Size: 499.26 KB

SKU: [Solved] NCCU-ProgrammingLanguage1- Assignment 2-yourStudentId Category: Tag:
5/5 - (1 vote)

Programming Language1Assignment 2Requirements: Create a Java project named yourStudentId_HW2 Write a single class named Tester_HW2 and adding main method in your class. For each question below, write your code in the main method. Your code must be properly formatted with sensible variable names! Refer to the text for code format examples.1. Write a program that checks the input year is a leap year or not.⚫ Rules for checking the year is a leap year or not:Leap year occurs mostly every 4 years, but every 100 years we skip a leap year unless the year is divisible by 400. For example, 2000, 2004 are a leap year, and 1900, 2019 are a common year.⚫ Additional requirement: Before the program checks the year is a leap year or not, it should check the input is an integer or not first. If not, print invalid inputSample output:Please input the year: 2019Common yearPlease input the year: 2016Leap yearPlease input the year: yyyyInvalid input2. BMI calculator.(1) Use Math class to calculate BMI.(2) Noted that the height variable is in the unit of centimeter, but it should be turned into meter to calculate BMI.(3) Round off your result to the 2nd decimal place. (DO NOT use printf)(4) Use String concatenation to create a String as in sample output, and show in the console.(5) Use If else statement to inform the user that he or she is underweight/normal weight/overweight based on the information below:Underweight: BMI < 18.5Normal weight: 18.5 <= BMI <= 25.0Overweight: BMI > 25Sample output:Please input the weight(kg): 63Please input the height(cm): 169BMI before rounded off: 22.058051188683873The BMI is 22.06. Normal weight3. Rewrite the program. Lab4 question 2 is a multiway branch question, you may use if-else or switch to answer the question. If you used if-else in lab4, please use switch to answer the question this time. If you used switch in lab4, please use if-else to answer the question this time.4. Rewrite the program. In lab4 question 3, the output isnt formatted. Please use String.format() to formatting the output. Please format the floating-point number up-to 2 decimal places.Read the Java Docs for the usage of String.format().Sample output:Convert from (g, kg, lb)? kgValue? 66.00 kg = 6000.00 g = 13.20 lbsProgramming Language I 20192

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] NCCU-ProgrammingLanguage1- Assignment 2-yourStudentId[Solved] NCCU-ProgrammingLanguage1- Assignment 2-yourStudentId
$25