Re: new to java need help!!!
There are some bugs in your program...
So i will give you shorter version of the solution for ur program..
import java.util.Scanner;
public class Region {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int regionTotal = 0, companyTotal = 0;
for (int i = 0; i < 4; i++) {
System.out.println(" Enter the region:");
String region = sc.nextLine();
System.out.println(" Month1");
int m1 = sc.nextInt();
System.out.println(" Month2");
int m2 = sc.nextInt();
System.out.println(" Month3");
int m3 = sc.nextInt();
regionTotal = m1 + m2 + m3;
System.out.println(" Total for " + region + " is " + regionTotal);
companyTotal += regionTotal;
}
System.out.println("Company Total : " + companyTotal);
}
}
This will work...
Re: new to java need help!!!
@jdwilliams92: When posting code please use code tags and also include the compiler error messages.
@nagarajn89: Please don't just rewrite code for people (especially when it's probably homework). It doesn't help the OP unless you explain what is wrong with their code so they can fix it themselves.
Re: new to java need help!!!
Thanks for the Correction.
Re: new to java need help!!!
Quote:
Thanks for the Correction.
Welcome to the forum.
All forums have their own ways of doing things. As a rough guide here, when its a newbie type question we try to advise people on how to fix the problems for themselves, sometimes providing code snippets or example code to help clarify the issue. When it's homework the level of help given tends to be proportional to the amount of effort the OP has put into solving it for themselves but we never do their homework for them. If it's a higher level issue then by all means provide working code.
Re: new to java need help!!!
I am sorry for the issues, will not happen again.
Re: new to java need help!!!