Answer to Question #298330 in C# for Zyke

Question #298330

An attorney’s office charge Php150 for every 20 minutes of consultation. Write a program that will ask




the user to enter the number of hours incurred for a consultation. The program then displays the bill of




the user and it starts over again. The loop will only stop if the user entered zero (0) hours for




consultation.

1
Expert's answer
2022-02-16T04:45:24-0500
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int hours = 0;
            int pricePer20 = 150;
            do
            {
                Console.WriteLine("Please enter the number of hours incurred for a consultation");
                hours = Convert.ToInt32(Console.ReadLine());
                if (hours != 0)
                {
                    int bill = pricePer20 * 3 * hours;
                    Console.WriteLine("Total price: Php{0}", bill);
                }
            } while (hours != 0);
            
 
        }
    }

   
}

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

Zyke
17.02.22, 01:14

Thanks

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS