Answer to Question #331040 in C# for NAS17

Question #331040

Write a program that repeatedly asks the user to enter two money amounts expressed in pounds. The program should then add the two amounts and display the answer in pounds. The program should then convert the amount in Rupees. (Set conversion rate: 1£=120.33 rupees). Display the answer in Naira. Use a do-while loop that asks the user whether the program should be terminated.


1
Expert's answer
2022-04-20T03:44:59-0400

public const double RUPEES_CONVERSATION_RATE = 120.33;

public const double NAIRA_CONVERSATION_RATE = 5.44;

public static void Main()

{

var askUser = true;

do 

{

Console.WriteLine("Please enter 2 money amount");

var firstMoneyAmount = double.Parse(Console.ReadLine());

var secondMoneyAmount = double.Parse(Console.ReadLine());

var sum = firstMoneyAmount + secondMoneyAmount;

var sumInRupies = ConvertToRupies(sum);

var sumInNaira = ConvertRupiesToNaira(sumInRupies);

Console.WriteLine("Sum in Naira = " + sumInNaira);

askUser = bool.Parse(Console.ReadLine());

}

while (askUser == true);

}

private static double ConvertToRupies(double moneyAmount) {

return moneyAmount * RUPEES_CONVERSATION_RATE;

}


private static double ConvertRupiesToNaira(double moneyAmount) {

return moneyAmount * NAIRA_CONVERSATION_RATE;

}


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