Answer to Question #12173 in C# for Gia

Question #12173
The cost of a brand new car is ₱420,000 for GL model and ₱3398,000 XL model. If a car phone will be installed, an additional ₱40,000 will be added to the cost. Moreover, 15% discount on the total cost will be given if the buyer pays in full(not installment), Write a Program that would input the car model bought, whether with car phone, use code ‘’W’’ for with car phone and ‘’O’’ for without car phone) and whether it will be paid in full(use code’’F’’ for full payments and ‘’I’’ for instalment).Program must then output the cost of the car.

* ₱ is the symbol for Philippine peso :) thank you Sir/Ma'am
1
Expert's answer
2012-07-26T08:51:19-0400
String model;
char phone;
char
paid;
double cost=0;
Console.WriteLine("Enter
model: ");
model = Console.ReadLine();
if (model
== "GL")
{
cost = 420000;

}
if (model == "XL")
{
cost =
3398000;
}
Console.WriteLine("Car phone:
");
phone = char.Parse(Console.ReadLine());
if
(phone == 'W')
{
cost = cost +
40000;
}
Console.WriteLine("Full or instalment:
");
paid = char.Parse(Console.ReadLine());
if
(paid == 'F')
{
cost = cost - 0.15 *
cost;
}
Console.WriteLine("Cost: " + cost);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS