Question: c# practice-- Get familiar with the == ! logical operators. Get familiar with the && || relational operators. Understand the use of the select statement

c# practice--

  1. Get familiar with the == ! logical operators.
  2. Get familiar with the && || relational operators.
  3. Understand the use of the select statement in a program.
  4. Understand how expressions are developed.
  5. Apply strategies learnt to a more complex real-world problem.

For each part you MUST:

  • Clearly comment your code (At least with your name and id number).
  • You must use appropriate variable names
  • Print meaningful input and output statements
  • Indent you code where necessary

Q1 - a:

Write a C# program that asks the user to enter two numbers and then prints which number is the larger one and which is the smaller one.

Q 1 - b:

Write a C# program that asks the user to enter three numbers and then prints which number is the largest. You must use an if..else structure.

Q 1 - c :

Write a C# program that asks the user to enter three numbers and then prints the numbers from smallest to largest. You Must use the basic form of the if statement (no else part)

Q 2:

Write a C program that reflects the flow chart below

c# practice-- Get familiar with the == ! logical operators. Get familiar

Q 3:

A worker is paid at the hourly rate of $11.50 per hour for the first 35 hours worked. Thereafter overtime is paid at 1.5 times the hourly rate for further hours worked. Write a C# program to read the number of hours worked per week, and calculate and output the overtime paid.

Q 4:

A variety store give a 15% discount on sales totalling $300 or more. Write a C# program to request the cost of 3 items and print the amount the customer must pay. YOU MUST USE an if..else structure.

Q 5: To be done as class example

An auto repair shop charges as follows. Inspecting the vehicle costs $75. If no work needs to be done, there is no further charge. Otherwise, the charge is $75 per hour for labour plus the cost of parts, with a minimum charge of $120. If any work is done, there is no charge for inspecting the vehicle.

Write a C# program to read the values for hours worked and cost of parts (either of which could be 0) and print the charge for the job.

  1. Draw a flow chart for the scenario above
  2. Write a C# program based on the flow chart you created
  3. Thoroughly test you program for all possible input situations / cases.

Start This is a decision structure. Read Cost price (CP) Read Selling price (SP) Is SP > CP ? Yes Profit = SP - CP No Loss = CP - SP Print Loss Print Profit End

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 Databases Questions!