Purchase Solution

Trouble Shooting C++ Code

Not what you're looking for?

Ask Custom Question

This code prints all elements of the array geo
for ( int i = 0; i < geo.length; i++ )
{
//the code is missing here

}
__________________________________________________________________
Where is the error in this code sequence?
// a is an ArrayList of strings
// a has already been declared and instantiated
a.size ( ) = 10;
________________________________________________________________

You coded the following in the Test.java class:
public static void main (string) [ ] args)
{
// cars is an ArrayList of Auto Objects
// cars has already been declared and instantiated
for ( Auto a ; cars ) // line 12
{
System.out.println (a. to string ( ) );
} // line 15
} //line 16
When you compile, you get the following message:
Test.java:12 '; 'expected
for ( Auto a ; cars ) // line 12
^
1 error
Explain what the problems are and how to fix them.

Purchase this Solution

Solution Summary

The solution fixed some errors or add some code using c++ language. All errors are explained.

Solution Preview

1.
This code prints all elements of the array geo
for ( int i = 0; i < geo.length; i++ )
{
for (int j=0; j<geo[i].length; j++)
System.out.println(geo[i][j]);
}

2.
a.size () is illegeal method. The right code ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Networking Questions

This quiz consists of some basic networking questions.