COMP 100 Programming Switch Statement Questions

I only need questions 2 to 6

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

COMP100
Nested If and Switch
Week 5
Exercise using the switch statement
Question 2-6 is required.
1.
2.
Write a C# program that prompts the user for a single letter. If the letter is a then display
Apple, if the letter is b or c then display Baby or Candy or anything else Sorry I don’t
know that letter.
Write a program that prompts the user for a menu choice. The program will display a
message based on the following table:
Choice
Message
1
“Calculate area”
2
“Calculate volume”
3
“Calculate surface area”
0
“Exit the program”
>
“ERROR: Invalid choice ”
If the user responds with a 1 after the program prompt, the program will display “Calculate area”.
Etc.
3.
Write a program that allows the user to enter two integers and a character If the character is
A, add the two integers If it is S, subtract the second integer from the first else multiply the
integers Display the results of the arithmetic
4.
Write a program that prompts the user for the number of courses and residency status
(domestic or international) and calculates tuition cost. Cost is calculated based on the table
below.
Domestic
$325 per course
International
$1375 per course
You decide how you want the user to enter her/his residency status and prompt accordingly,
also you should use named constants for the cost per course
5.
Write a program that prompts the user for a day of the week. The program will display a
message based on the following table:
Choice
Sun
Mon
Tue
Wed
Thu
n.k.p.
Message
“Home”
“Work”
“Work”
“Home”
“Work”
Fall 2022
Page 1 of 4
COMP100
Fri
Sat
6.
7.
8.
Nested If and Switch
Week 5
“Work”
“Work”
Write a program for a furniture company. Ask the user to choose Pine, Oak or Mahogany.
Show the price of a table manufactured with the chosen wood Pine tables cost $100, Oak
tables cost $225, and Mahogany tables cost $310. You must use named constants and switch.
Also you must be able to accept any variation on the case. E.g. Pine, pine PINE, pinE, Pine …
should give $100.
Saturdays and Wednesdays are Narendra’s days off. Write a program to prompt the user for
the day of the week. The program will display “Home day” or “Work day” depending on the
input
Harmonised tax exists in Ontario, New Brunswick, New Foundland, Nova Scotia, and British
Columbia. Use a suitable e a switch statement to prompt the user for a province and display a
message HST exist or HST does not exist. Possible province {ON, QC, NS, NB, MB, BC, PE, SK,
AB, NL, YT, NT, NV}
n.k.p.
Fall 2022
Page 2 of 4
COMP100
9.
Nested If and Switch
Week 5
Write a program to calculate the roots of a quadratic equation. The flowchart below
illustrates a possible solution
Start
Prompt and
accept a, b & c
true
false
a == 0
Display
“invalid input
for a”
p = -b/2a
d = b2-4ac
true
false
d >= 0
q = Math.Sqrt(d)/2a
q = Math.Sqrt(-d)/2a
Display p +
q and p – q
Display p + qi
and p – qi
Stop
n.k.p.
Fall 2022
Page 3 of 4
COMP100
Nested If and Switch
Week 5
10. Write a program that prompts the user or an hourly pay rate. If the value entered is less than
$5 65, display an error message
11. Write a program that prompts a user for an hourly pay rate. If the value entered is less than
$5 65 or greater than $49 99, display an error message
12. Write a program that prompts a user for an hourly pay rate. If the user enters values less than
$5.65 or greater than $49 99, prompt the user again. If the user enters an invalid value again,
display an appropriate error message. If the user enters a valid value on either the first or
second attempt, display the pay rate as well as the weekly rate which calculated as 40 times
the hourly rate
13. Write a program for a college’s admissions office. The user enters a numeric high school
grade point average (for example, 3 2) and an admission test score. Print the message
“Accept” if the student meets either of the following requirements
A grade point average of 3.0 or higher and an admission test score of at least 60
A grade point average of less than 3.0 and an admission test score of at least 80
If the student does not meet either of the qualification criteria, print ‘Reject”
14. Write a program that prompts the user for an hourly pay rate and hours worked. Compute
gross pay (hours times pay rate), withholding tax, and net pay (gross pay minus withholding
tax) Withholding tax is computed as a percentage of gross pay based on the following
Gross Pay
Withholding Percentage
Up to and including 300.00
10%
300.01 and up
12%
15.
a. Write an application for a lawn-mowing service. The lawn-mowing season lasts 20 weeks.
The weekly fee for mowing a lot under 400 square feet is $25. The fee for a lot that is
400 square feet or more, but under 600 square feet, is $35 per week. The fee for a lot
that is 600 square feet or over is $50 per week. Prompt the user for the length and width
of a lawn, and then print the weekly mowing fee, as well as the total fee for the 20-week
season
b. To the Lawn application you created in Exercise 8a, add a prompt that asks the user
whether the customer wants to pay (1) once, (2) twice, or (3) 20 times per year. If the
user enters 1 for once, the fee for the season is simply the seasonal total. If the customer
requests two payments, each payment is half the seasonal fee plus a $5 service charge. If
the user requests 20 separate payments, add a $3 service charge per week. Display the
number of payments the customer must make, each payment amount, and the total for
the season
n.k.p.
Fall 2022
Page 4 of 4

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER