TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prime b
NA
810
346.9k
Convert C# to C++ help ?
Sep 20 2012 4:36 PM
You want to calculate how much it would cost to carpet a room in your new apartment. For the sake of simplicity, we will solve this problem for a single rectangular room. The program should ask its user to enter the room's length and width in feet (allowing decimal places if necessary) and then calculate the floor area of the room. Because most carpet prices are given in units of dollars per square yard, your program should ask for the carpet price that way and then convert that price to dollars per square foot before using it to calculate the overall cost of the carpet for your room in dollars. The program should display the calculated room area and the overall cost of the carpet for your room, both output rounded to a
precision
of two decimal places.
Could you also tell me the program is correct, thank you!
double width,length,carpetArea,carpetPrice,totalDue;
Console.WriteLine("Hello");
Console.WriteLine("Please enter width");
width = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("PLease enter length");
length = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Please enter the price per square");
carpetPrice = Convert.ToDouble(Console.ReadLine());
carpetArea = 2 * (width) + 2 * (length);
totalDue = carpetPrice * carpetArea;
Console.WriteLine("The carpet area is {0}, total due is {1}$", carpetArea, totalDue);
Console.ReadLine();
Reply
Answers (
3
)
My OnSubmit in my html form doesn't work, it just goes to the URL in the action. I have a vb func...
How to pass the data of my selection from SubForm to the MainForm