Question: In this lab, you will work with assigning values to variables of multiple types that you have declared. Additionally, you will begin to play with

In this lab, you will work with assigning values to variables of multiple types that you have declared.
Additionally, you will begin to play with operators to build more complex expressions.
EXAMPLE PROGRAM
The example program demonstrates variable declaration and assignment, and arithmetic operators.
Download SimpleMath.cs, add it to a new Console Application project, and take some time to explore
the code, using my comments as a guide. Try changing the data types from int to double, and see what
happens, or experiment with different operators.
When you are done, proceed to your program below.
YOUR PROGRAM
Now you will write code that is similar to what you have just seen. This is the code that you will submit
to be graded for this lab.
Create a new source file for this lab. You should declare 5 variables, as follows:
1. A variable to hold a string for a persons first name.
2. Three variables to hold three assignment scores. They should be able to store integer values.
3. A final variable to hold the average of the three scores. It should accommodate a decimal value.
Names are up to you, but you should attempt to choose names that are meaningful and easy to read.
Once you have your variables declared, you should assign values to each of the first four (the persons
name, and the three assignment scores). What values you choose are up to you, but you will need to
make sure that you choose data that the variable types can accommodate (do not try to store a decimal
number in an integer variable, for instance).
Finally, calculate the average of the three scores, store the value in your average variable, and then
output the students name and average, as seen in the sample output below. The expression to calculate
the average is not difficult, but is more complex than others we have seen before, so Ive included a
reference here as to how it should look (anything contained inside of brackets [...] is a variable name
that you have declared):
[Average]=([Score 1]+[Score 2]+[Score3])/3;
Your output should match mine as closely as possible. Specific wording can change, as will the name and
average based on the data you assigned to the values, but the basic form and function should remain
the same. Name the .cs file according to the standard convention ([First Initial][Last Name]_Lab2.cs),
and submit the completed .cs file through the Blackboard assignment submission tool. Dont forget to
include the comment block at the top.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!