I had a book exercise where I figured out how much carpet would cost, the code for that is here: http://pastebin.com/nmfG8yd2

Now I am trying to take that, and make it a useful program by asking you for the info instead of it being pre-set.

What I have so far is here: http://pastebin.com/Xg9r2Pxv

The issue I have right now is it will ask the first question, then it spams all the rest at the same time and runs off one more user input, then gives a insane answer, lol.

If someone has time to help me out with this it would be appreciated, I don't think i'm too far off from getting it right.

Thanks guys.

Recommended Answers

All 2 Replies

I'm not sure you want to use Console.Read() take a look at the documentation It reads the next character in the input stream, try using ReadLine maybe? take a look at this usefull information

I've never read from input in C#, so I dont know why it would be "spamming" all the answers.

note that if you use Console.ReadLine() you might need to convert the character/string into a double, rather than just

double roomLengthFeet = Console.ReadWhatever();

I used ReadLine() in the begining, but then I had a issue where it was convinced it was a string and not a integer, I would get the error of "Can not convert string into double" for some reason changing it to Read() fixed that problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.