Question

C# vitual studio 2019 need flowchart and code – If/Else and Switch Statements For this project...

C# vitual studio 2019


need flowchart and code

– If/Else and Switch Statements

For this project you will be calculating car maintenance based on the area the user wishes to have maintenance perform.

Complete with If/ese or the Switch Statement

1. Show menu for tires, oil, state inspection, and wash

2. Tires

a. $100 per tire

b. User tells you how many tires

c. Show out their cost

3. Oil

a. Synthetic $75

b. Regular $45

c. Show out their cost

4. State Inspection

a. Flat $20

b. Show out their cost

5. Wash

a. Outside - $50

b. Inside too $125

c. Show out their cost

0 0
Add a comment Improve this question Transcribed image text
Answer #1

using System.IO;
using System;

class Program
{
static void Main()
{
Console.WriteLine("Menu\n"); // Print menu
Console.WriteLine("1.Tires\n");
Console.WriteLine("2.Oil\n");
Console.WriteLine("3.State Inspection\n");
Console.WriteLine("4.Wash\n");
Console.WriteLine("Enter the Option\n");
  
int option = Convert.ToInt32(Console.ReadLine()); // Take input from User
  
switch(option){ // Switch condition for input
case 1: {
Console.WriteLine("Price of one tire is $100\n");
Console.WriteLine("Enter the no. of tires\n");
int num = Convert.ToInt32(Console.ReadLine());
num=100*num;
Console.WriteLine("Total cost of tires: " + num + "\n");
}
break;
case 2:{
Console.WriteLine("Price of Synthetic oil is $75 and Price of Regular oil is $45\n");
Console.WriteLine("Coose the '1' for Synthetic oil and '2' for Regular oil\n");
int num = Convert.ToInt32(Console.ReadLine());
int ans=0;
if (num==1)
{
ans=75;
}
else
{
ans=45;
}
Console.WriteLine("Total cost of oil: " + ans + "\n");
}
break;
case 3: {
Console.WriteLine("Cost of Flat State Inspection is $75\n");
Console.WriteLine("Coose '1' for Flat State Inspection and '2' for Other\n");
int num = Convert.ToInt32(Console.ReadLine());
int ans=0;
if (num==1)
{
ans=75;
}
else
{
ans=0;
}
Console.WriteLine("Total cost of oil: " + ans + "\n");
}
break;
case 4:{
Console.WriteLine("Price of Outside Wash is $50 and Price of Full Wash is $125\n");
Console.WriteLine("Coose the '1' for Outside Wash and '2' for Full Wash\n");
int num = Convert.ToInt32(Console.ReadLine());
int ans=0;
if (num==1)
{
ans=50;
}
else
{
ans=125;
}
Console.WriteLine("Total cost of oil: " + ans + "\n");
}
break;
default: Console.WriteLine("Choose Correct Option");
break;
}
  
}
}Tue 02:18 - OX Activities 9 Google Chrome </> Online Csharp Compiler - + € → C o tutorialspoint.com/compile_csharp_online.phpTue 02:18 - OX Activities 9 Google Chrome </> Online Csharp Compiler - + € → C o tutorialspoint.com/compile_csharp_online.phpTue 02:19 - OX Activities 9 Google Chrome </> Online Csharp Compiler - + + → C o tutorialspoint.com/compile_csharp_online.php

Add a comment
Know the answer?
Add Answer to:
C# vitual studio 2019 need flowchart and code – If/Else and Switch Statements For this project...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program that uses: .selection constructs (if, if else, and switch) .multiway branches .looping...

    Write a C++ program that uses: .selection constructs (if, if else, and switch) .multiway branches .looping constructs (do and while loops) .Boolean expressions, bool and char types. 1. Develop a program that calculates charges for an Internet provider. The cost is determined by the amount of data used and the consumer plan. Package B (basic) is the most affordable if you plan on using < 20GB (20,000MB), however, if you consume more than 20GB (20,000MB) you are charged for each...

  • Please, I need help with program c++. This is a chutes and ladders program. The code...

    Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT