You will write a program that recommends treatment for a contagious disease on an alien planet.
The file you upload should be named “XYProjectOne.java”, where “X” and “Y” are your first and last initials.
Copyright© 2022, Dallas College. All Rights reserved. Page 1 of 4
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)
HelpfulTips for Programming Project One
Creating the solution to a programming problem is not an exercise in finding
an answer on the Internet and submitting it as your own work. Submitting
someone else’s work as your own is plagiarism. Plagiarism is an example of
Scholastic Dishonesty. Copying all or part of a solution from a web site is
plagiarism.
Worse, you have not learned anything about how to use a computer
program to solve a problem. You are always far better off submitting your
own original work. You will always be given credit for attempting to solve the
problem. On the other hand, if plagiarism is detected, you will receive a
grade of zero (0).
Start early. Read the book. Ask for help if you get stuck. Do your own work.
Do not share your work with any other students. Do not ask any other
students to share their work. There are no group projects in this course.
In Programming Project One you are asked to prompt your user for several
values. Be clear and specific in your wording of these prompts. If you are
asking for weight in kilograms, ask for weight in kilograms.
Consider using a floating-point data type like double to store numeric
values. This will allow for the broadest range of possible input values.
To guard against using bad values, you must validate user input. The best
way to do this is with an input validation loop. The subject of Input
Validation Loops is covered in section 4.3 of our textbook.
Remember, upper-case “R” and lower-case “r” are considered equivalent.
Be sure to allow your user to run the program repeatedly.
Do not forget to give your user a convenient way to terminate the program.
Do a Top-Down analysis and divide your program into components. The
classic Input-Process-Output analysis is not a bad place to start. You might
even consider isolating the calculation using the revised Smithfield formula
as a function. Use your knowledge of the hierarchy of operations to evaluate
the Smithfield formula correctly. Be careful.
Test your program before submitting it. There are several examples in the
instructions. Use these input values to confirm that your program is working
correctly.