Multiple Sales Amounts Create a program, using at least one For loop, that displ
ID: 3672065 • Letter: M
Question
Multiple Sales Amounts Create a program, using at least one For loop, that displays the Sales Amounts made in each of 4 regions (North, South, East, and West) during a three month period. The program should allow the user to enter 4 sets (one set for each region) of three sales amounts (one sales amount for each month). The program should display each regions total sales for the three month period, and the companies total sales for the three month period. Example data (Remember, the user should be able to enter any data they wish, as long as it follows the below format): North - 2000, 4000, 3000 South 2000, 5000, 5000 East 3000, 2000, 1000 West 4000, 1000, 6000 The final date/time to submit this assignment is Friday, Feb. 26th at midnight.Explanation / Answer
Hello,
below is your code
package sophy;
import java.util.Scanner;
public class sales {
public static void main(String as[]){
String north="",south="",east="",west="";
Scanner sc=new Scanner(System.in);
System.out.println("NORTH");
int i=1;
for(i=1;i==3;i++){
System.out.println("Enter sales");
north=north.concat(sc.next())+"";
}
System.out.println("SOUTH");
for(i=4;i==6;i++){
System.out.println("Enter sales");
south=south.concat(sc.next())+"";
}
System.out.println("EAST");
for(i=7;i==9;i++){
System.out.println("Enter sales");
east=east.concat(sc.next())+"";
}
System.out.println("WEST");
for(i=10;i==12;i++){
System.out.println("Enter sales");
sc.next();
west=west.concat(sc.next())+"";
}
System.out.println(north+" ");
System.out.println(south+" ");
System.out.println(east+" ");
System.out.println(west+" ");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.