*/
import java.io.*;
public class DriverBuggy
{
public static void main(String args[]) throws IOException
{
Buggy app;
app = new Buggy();
app.appMain();
} // end of main()
} // end of class Driver
class Buggy
{
/* Instance Data Declarations */
BufferedReader stdin; // define stdin
int firstVar, secondVar, thirdVar;
/* appMain method calls for initialization, processing, output */
public void appMain() throws IOException;
{
stdin = new BufferedReader
(new InputStreamReader(System.in));
// create input string object
FirstVar = 11;
secondVar = 22;
thirdVar = 33;
while(firstVar < 18)
{
System.out.println("Calling the calc method.");
calc();
}
} // end of appMain()
/* calc method calls for comparisons, calculations & detail output */
void calc()
{
if(firstVar < 13)
{
System.out.println("firstVar is " + firstVar + \n");
firstVar = firstVar + 1;
}
else
{
System.out.println("firstVar is 13" or greater. n);
firstVar = firstVar + 2;
secondVar = secondVar - 1;
firstVar + secondVar = thirdVar;
}
} // end of calc()
/* reportOut method does the final output /*
void reportOut()
{
System.out.println("\nFINAL REPORT");
System.out.println("------------");
System.out.println("firstVar is " + firstVar);
System.out.println("secondVar is " + secondVar);
System.out.println("thirdVar is " + thirdVar);
if(firstVar < 11);
{
System.out.println("THIS SHOULD NOT PRINT");
}
} // end of class Buggy
Sugarskull 0 Newbie Poster
Recommended Answers
Jump to Post"thirdValue" needs to be on the left side of the assignment operator in the form
variable = <expression>
Jump to PostYes, that's correct. You want to set "thirdVar" equal to the expression "firstVar + secondVar".
Jump to Post@OP
what was wrong with this thread
http://www.daniweb.com/forums/thread114556.html
Oh, wait, don't tell me. You were upset that I didn't simply give you the answer, but rather tried to make you think. That must have hurt, man. I can't imagine the pain.
Ungrateful kids these days.
Jump to PostNow I don't want to start a flame war...*usually followed by a flame war*
but we're brand new at this stuff. We're already confused and not getting it-thus we come to a forum of people with more experience than we for assistance. We've already read a book or had the …
Jump to PostBTW, read the thread referenced. The last post in that thread contained some pointed info and questions. If the OP had read that info, then answered the questions, the problem, and it's solution would have become painfully obvious. Seemingly though, the assignment wasn't important enough for the OP to show …
All 25 Replies
Sugarskull 0 Newbie Poster
VernonDozier 2,218 Posting Expert Featured Poster
gummibear 0 Newbie Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
gummibear 0 Newbie Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
gummibear 0 Newbie Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
gummibear 0 Newbie Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
gummibear 0 Newbie Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
udscrick 0 Newbie Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
jon.kiparsky 326 Posting Virtuoso
Stormin 0 Newbie Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
tong1 22 Posting Whiz
Stormin 0 Newbie Poster
tong1 22 Posting Whiz
jon.kiparsky 326 Posting Virtuoso
Stormin 0 Newbie Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
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.