|
-
November 18th, 2011, 08:51 AM
#1
new to java need help!!!
Hi I am writing a program that has to have 1 for loop that asks the user to enter in sales for 4 regions (north south east west) and asking each region to enter 3 amounts of data for 3 months. it should return the total for each region and then the total of the company. This is what I have so far but I am getting a return error message for my integer. Can you tell me where I am screwing up? could you help me fix the syntax?
import java.util.Scanner;
public class region
{
public static void main(String args[])
{
Scanner sc= new Scanner (System.in);
int totregion []= new int[4]; // calls each regions
for (int i=0; i< 4; i++) //use the for loop to run the 3 months for each region.
{
int getRegionData= totregion [i];
}
int getRegionData; {
System.out.print ("Enter region's first month sales. (note: enter
region monthly data in order: north, south, east, west)");
int month1=sc.nextInt();
System.out.print ("Enter region's second month sales.");
int month2=sc.nextInt();
System.out.print ("Enter region's third month sales.");
int month3=sc.nextInt();
int total=month1+month2+month3;
return total; // this is where I am getting a return value error.
}
System.out.print(totregion [0],totregion [1], totregion [2], totregion [3]);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|