Visual Studio C#

NOTE:

  • Read the instructions following link that will help you submit the assignment correctly via CANVAS:

http://guides.instructure.com/s/2204/m/4212/l/41972-how-do-i-submit-an-online-assignment

  • Please note the University’s plagiarism policy as listed in the syllabus. This policy will be strictly enforced for every assignment.

OBJECTIVE:

The power of computer programming is manifested greatly in real-life decision-making situations.

To make a good decision, the data must have integrity. For example, an exam score of -67 or 235 does not make sense, and if an instructor assigns a letter grade based on the invalid number, the grade will have no meaning. Recall “Garbage in, Garbage out.”

In this regard, you will do the following preparation.

PREPARATION: 

  • Download the zipped folder named HW4_PRACTICE from CANVAS
  • Completely unzip this folder. DO NOT save your work in this folder and submit for grading.
  • Find the SOLUTION file named HW4_PRACTICE.sln and open it in VISUAL STUDIO.
  • Open the project titles PRACTICE_1_NoInputValidation
    • Study the codes and see how input data is read from the keyboard using the ReadLine(); command; how the data is converted to numeric before computation.
    • Run the program with different input data: bad ones, good ones.
    • Notice that when you enter BAD data (e.g., -75), the outcome becomes nonsensical!
    • Study the output.
  • Open the project titles PRACTICE_2_WithInputValidation
    • Study the codes and see how input data is read from the keyboard using the ReadLine(); command; how the data is converted to numeric AND validated before computation.
    • Run the program with different input data: bad ones, good ones.
    • Notice that when you enter BAD data, the program rejects it and the program is terminated.
    • Study the output
  • Make sure you understand these practice problems thoroughly before you proceed with homework problems below. DO NOT save your work in this folder and submit for grading.

 

NOTE:

  • Create a new folder and name it HW4_Yourname on your local drive. Replace the “Yourname” portion with your actual name (Example: HW4_Joe_Blow), for student Joe Blow who is enrolled in the class.
  • Save all C# solution and projects in this folder. Zip this HW4_Yourname folder properly and submit.

SECTION A:           SALES PROFIT APP                                                                                                                                           (20 Points)    

Case Study:          You are asked to write a C# report application that displays the amount of profit an organization receives based on its sales amount. The more sales documented, the larger the profit ratio. Allow the user to input the total sales figure for the organization from the keyboard.

Compute the profit earned based on the following decision table. The given profit ratios are fixed.

Sales Amount Range Profit Ratio to be used to be used to compute Profit
to $1,000.00                                      (both inclusive) 3.0%    (of the sales amount)
$1,000.01 to $5,000.00                                   (both inclusive) 3.5%
$5,000.01 to $10,000.00              (both inclusive) 4.0%
Over $10,000.00 4.5%

 

  • Be sure to design your solution so that all possible sales amount situations are accounted for in your program. For example, the sales amount $5,000.02 will belong to the 3rd range in the table.
  • Makes sure to include data validation so that no negative sales amounts are allowed. If an invalid data is entered, terminate the program with a friendly message.
  • The final output must be professionally formatted with symbols such as “$” and “,” with two decimal places.

Use the following names:

SOLUTION NAME:               HW4

PROJECT NAME:                   SalesProfit

PROGRAM NAME:               SalesProfitApp

Some sample results for valid data input are shown blow:

 

 

SECTION B:            BMI                                                                                                                                                                           (20 Points)    

 

BMI CASE: Body Mass Index (BMI) is a number calculated from a person’s weight and height. BMI is a fairly reliable indicator of body fatness for most people. BMI does not measure body fat directly, but research has shown that BMI correlates to direct measures of body fat. BMI is used as a screening tool to identify possible weight problems for adults. The standard weight status categories associated with BMI ranges for adults are shown in the first table on the left, and the formula for calculating BMI is shown in the second table on the right.

 

Depending on where you live, the Foot-Pound units or the Metric (meter-kilogram) units are used in the BMI formula. In our case, we will use only the Foot-Pound units

A health clinic has asked you to write a BMI Console Application for them using the C# language.

 

INPUT: (Variables – use Camel Case)

  • All input data are entered from the keyboard using ReadLine (); with a nice friendly and helpful prompt message.
  • Double Weight (numeric) in “Pounds” via the keyboard. (Must be greater than zero).
  • Integer Height (numeric) in “Feet” portion via the keyboard. (Range should be 3 ft. to 8 ft. both inclusive)
  • Integer Height (numeric) in “Inches” portion via the keyboard. (Range 0 in. to 11 in. both inclusive)
  • ALL INPUTS MUST BE VALIDATED PROPERLY. For instance, Height (“Feet” portion) cannot be less than 3 or greater than 8; Height (“Inches” portion) cannot be less than 0 or greater than 11. Weight cannot be negative.

 

OUTPUT: (Must be nicely formatted to ONE DECIMAL place only)

  • Report Title
  • All input values (weight, height (‘feet” portion, and height (“inches” portion).
  • The correct BMI value. It must be formatted to 1 decimal place.
  • The weight status message if the user is “Underweight”, “Normal”, “Overweight”, or “Obese.”

 

VALIDATION:  (Terminate program with an appropriate message if any data is invalid)

  • Height portion in Feet must be a positive integer between 3 and 8.
  • Height portion in Inches must be a positive integer between 0 and 11.
  • Weight in pounds must be a positive decimal greater than 0.0.

CALCULATION:

The algebraic formula (not in C# format) to calculate the BMI is:

BMI = WEIGHT (lbs.) ÷ [HEIGHT (total inches only)] 2 * 703 (a constant)      

 

Notice that you must use only total inches for the height. So, the feet portion of the height entered must be first converted to inches and then added to the inches portionBEFORE you use that number in the formula.

Use the following names:

SOLUTION NAME:               HW4

PROJECT NAME:                   BMI

PROGRAM NAME:               BMIApp

 

SAMPLE RESULTS:

The output is just for your reference and it is not properly formatted. You must display a nicely formatted PROFESSIONAL LOOKING report in your program.

 

Height (in feet portion) Height (in inches portion) Weight (in lbs.) BMI Weight Status
5 7 150.0 23.5 Normal
5 0 150.0 29.3 Overweight
5 10 220.0 31.6 Obese

Order from us and get better grades. We are the service you have been looking for.