0

I need help with the errors in my code. Here is my pseudocode along with my program code following:

This is my pseudocode:
Start
Declare Variable
int length
int width
int area

Print (“Enter length of room in ft.: “),
Input length
Print (“Enter width of room in ft.: ”),
Input width

Area = length * width

Display (“The floor is “ + area + “square feet”);

This is my program code:

//declare variable
            int length;
            int width;
            int area;

            //input
            Console.Write (“Enter length of room in feet: “);
            length = Convert.ToInt64 (Console.ReadLine());

            Console.Write ( “ Enter width of room in feet:“);
            width = Convert.ToInt64 (Console.ReadLine());

            //process
            area = length * width;

            //output
            Console.WriteLine ("The floor is " + area "square feet.");

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

3
Contributors
7
Replies
10
Views
7 Years
Discussion Span
Last Post by abarlowa
0

OK, I figured out what the last line is but I still need help with lines 18 and 21 but I also do not know how to show the line numbers.

//output
Console.WriteLine ("The floor is " + area ("square feet."));

0

Line #8 and #11 : Long type value cannot be converted into int (Int32) implicitly. Use Convert.Int32.

Line #17. + operator concatenate two strings.

Console.WriteLine ("The floor is " + area + " square feet.");
0

OK, thanks for your help although in my program it also says there is a problem with lines 7 & 10 even with the change.

//declare variable
            int length;
            int width;
            int area;

            //input
            Console.Write (“Enter length of room in feet: “);
            length = Convert.Int32 (Console.ReadLine());

            Console.Write ( “Enter width of room in feet:“);
            width = Convert.Int32 (Console.ReadLine());

            //process
            area = length * width;

            //output
            Console.WriteLine ("The floor is " + area ("square feet."));

Edited by abarlowa: n/a

0

Convert.ToInt32

You're also going to have a problem on the last line. You've got a set of parentheses you don't need and there's a + symbol you're lacking that you do need.

0

ok, got that

//output
            Console.WriteLine ("The floor is " + area + "square feet.");

I still need help with lines 1 & 4:

Console.Write (“Enter length of room in feet: “);
            length = Convert.Int32 (Console.ReadLine());

            Console.Write ( “Enter width of room in feet:“);
            width = Convert.Int32 (Console.ReadLine());

Edited by abarlowa: n/a

0

Got it Thanks...You'll are a great help. I am working on one more hopefully I can get it all by myself. I am doing pseudocodes and flowcharts first. This is all new to me.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.