Java Programming
Copyright © 2022, Dallas College. All Rights reserved. Page 1 of 4
Outbreak of Ginjuk on the Planet Qwork The planet Qwork is currently experiencing an outbreak of Ginjuk, a serious, contagious disease. Inhabitants of the planet Qwork are divided into three distinct genders, identified by the letters: “R”, “S”, and “T”. Each of the three different genders are affected in slightly different ways when they contract Ginjuk. A substance called Biximent, found in their circulatory system, is an important factor in determining the appropriate treatment.
NOTE: This is not an opportunity for you to find a solution to this problem on the Internet and submit that solution as your own work. This is your chance to earn points by showing us what you have learned.
Your job as Medical Officer for the Interplanetary Aid Society (IAS) is to recommend treatment for inhabitants who may have contracted Ginjuk. Possible treatments vary from medication and ultraviolet light baths to hospitalization based on gender and several other factors. You must write a computer program that evaluates citizen responses from interview questions, determines the Biximent Metabolic Index (BMI), and recommends an appropriate treatment based on the value of BMI.
The Biximent Metabolic Index (BMI) value can be estimated very accurately by using the revised Smithfield formula:
𝐵𝐵𝐵𝐵𝐵𝐵 = 2.14 ∗ Age + BL ∗ 329
Weight ∗ GF
Where: BMI is the Biximent Metabolic Index (BMI)
Weight = Weight in kilograms
BL = Biximent Level
Age = Age in solar cycles
GF = Gender Factor
Gender factors for each gender type are as follows:
Gender Identification Gender Factor R or r 7.27 S or s 2.38 T or t 5.49
Copyright © 2022, Dallas College. All Rights reserved. Page 2 of 4
A comprehensive battery of tests has been administered to all citizens. These tests reliably determine the level of Biximent that is present in the circulatory system of each inhabitant. Weights are reported in kilograms and inhabitants report their age as a specific number of solar cycles.
This table shows the severity and which treatment should be recommended based on the value of the Biximent Metabolic Index (BMI) value.
Range of BMI Values Recommended Treatment Less than 75 Mild case, no treatment required
75 or greater, but less than 127.5 Serious case, Medication treatment 127.5 or greater, but less than 275 Acute case, Ultraviolet treatment 275 or greater, but less than 375 Severe case, Replacement therapy
375 or greater Extreme case, Hospitalization It is important to note that if the Biximent Metabolic Index (BMI) value is greater than 180.00, inhabitants are considered “Highly Contagious”, and an additional line of output is required in your recommendation report.
Your program should do the following:
1. Prompt the citizen for their weight in kilograms. 2. Prompt the citizen for their age in solar cycles. 3. Prompt the citizen for their gender identification (R, S, or T) 4. Prompt the citizen for their Biximent level. 5. Calculate the Biximent Metabolic Index (BMI) 6. Display the recommended treatment for that level of BMI in a nicely
formatted, comprehensive report that: • Echoes the input parameters: weight, age, gender identification,
and Biximent level. • Displays the Biximent Metabolic Index (BMI) level to 2 decimal
places. • Recommends treatment appropriate to the BMI level. • Identifies a “Highly Contagious” condition, if appropriate.
Lower-case letters (“r”, “s”, and “t”) are sometimes used by the clans that inhabit the northern hemisphere of the planet to indicate their gender. These letters should be treated the same as their upper-case equivalents.
Remember your training and have confidence. Citizens of Earth are immune to Ginjuk. These people need your help!
Copyright © 2022, Dallas College. All Rights reserved. Page 3 of 4
Section 4.3 of the textbook discusses Input Validation Loops.
Your program must guard against bad values by validating all input data. Numeric entries must be nonzero and positive but may be entered as floating-point values. For example, a citizen’s weight may be entered as 147.25 kilograms. The number of solar cycles is typically reported using a floating-point format, such as 12.25.
The revised Smithfield formula is most accurate when the parameters in the formula fall within certain well-defined ranges:
• Weight must be greater than 41.5 kilograms. • Age must be between 11 and 101 solar cycles. • Biximent level must be at least 35.
Parameter entries that do not comply with these restrictions are always user entry errors that should be detected and rectified by your program as all citizens have been screened to ensure compliance with these limitations.
Here are examples of what your report for each citizen could look like.
For a citizen of gender type T, who is 59 cycles old and weighs 97.25 kilograms with a reported Biximent Level of 64.92, the Biximent Metabolic Index is 166.26, their condition is Acute and Ultraviolet is recommended.
Biximent Metabolic Index Report Gender: R Age: 30 cycles Weight: 150 kilograms Biximent Level: 37 BMI: 75.36 Recommended treatment: Serious Case, Medication
Remember to add an additional line of output when the Biximent Metabolic Index (BMI) value for an inhabitant is greater than 175.00.
Biximent Metabolic Index Report Gender: S Age: 83.25 cycles Weight: 90.5 kilograms Biximent Level: 143 BMI: 396.58 Recommended treatment: Extreme case, Hospitalization Inhabitant is Highly Contagious.
Copyright © 2022, Dallas College. All Rights reserved. Page 4 of 4
Your program should execute repeatedly allowing multiple citizens to be evaluated and providing each with their recommended treatment.
To receive full credit for this programming assignment, you must:
• Use the correct file name, “XYProjectOne.java”, where “X” and “Y” are your first and last initials. For example, if your name was Edgar Smith, the file you submit should be named “ESProjectOne.java”.
• Submit a program that compiles and executes correctly. • Interact effectively with the user in your prompts and error messages.
Grading Guideline:
• Include a comment containing the student’s full name. (5 points) • Prompt the citizen for their age in solar cycles. (5 points) • Prompt the citizen for their weight in kilograms. (5 points) • Prompt the citizen for their gender identification. (5 points) • Use the appropriate gender factor based on their gender identification.
(5 points) • Prompt the citizen for their Biximent Level. (5 points) • Validate all the input values. (20 points) • Calculate the Biximent Metabolic Index (BMI) value correctly. (10
points) • Correctly display a recommendation report showing all the input
parameters. (10 points) • Display the BMI value as part of the report showing two digits after the
decimal point. (5 points) • Determine and display the appropriate recommended treatment based
on the value of the BMI. (10 points) • Correctly add “Highly Contagious” when the BMI value is greater than
180.00. (5 points) • Allow the program to repeatedly make BMI estimates. (5 points) • Use prompts and error messages that were easy to understand. (5
points)
- Outbreak of Ginjuk on the Planet Qwork