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.");

Recommended Answers

All 7 Replies

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."));

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.");

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."));

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.

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());

Replace the “ in your code with "

And, again, Convert.ToInt32

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.

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.