import acm.program.*;
public class mainApp extends ConsoleProgram {
public void run() {
////////////////////////
Item aItems[] = new Item[26];
aItems[1] = new Motherboard("970a", 2014, 200.0, "GIGABYTE", "INTEL", 64, 5);
aItems[2] = new Motherboard("gb4", 2012, 150.0, "ASROCK", "AMD", 32, 4);
aItems[3] = new Proccesor("I5", 2010, 180.0, "INTEL", 3.3, 4);
aItems[4] = new Proccesor("I7", 2014, 900.0, "INTEL", 4.0, 4);
aItems[5] = new Gcard("RADEON", 2012, 300.0, "GIGABYTE", "AMD", 4);
aItems[6] = new Gcard("RADEON", 2010, 200.0, "SAPPHIRE", "NVIDIA", 2);
aItems[7] = new Ram("IO", 2010, 100.0, "ASUS", "DDR", 4, 1600);
aItems[8] = new Ram("LM", 2012, 160.0, "PALIT", "DDR3", 8, 2000);
aItems[9] = new HardDrive("E2", 2013, 100.0, "WD", "SSD", 2.5, 750);
aItems[10] = new HardDrive("LM", 2012, 150.0, "HP", "HDD", 3.5, 1000);
aItems[11] = new Monitor("CFA90", 2014, 180.0, "SAMSUNG", "LCD", "23,5", "1080", "HDMI");
aItems[12] = new Monitor("27EA", 2013, 280.0, "ASUS", "LED", "28", "1080", "HDMI");
aItems[13] = new Mouse("Dethadder", 2013, 80.0, "Razer", "Optical", "wired");
aItems[14] = new Mouse("M9Q", 2013, 80.0, "Microsoft", "laser", "wireless");
aItems[15] = new Keyboard("Blackwidow", 2014, 130.0, "Razer", "wired");
aItems[16] = new Keyboard("GK10", 2013, 100.0, "CM Storm", "wireless");
aItems[17] = new Printer("PS3H", 2012, 90.0, "HP", "laser", "colored");
aItems[18] = new Printer("SPP5", 2013, 190.0, "SAMSUNG", "inkjet", "black and white");
////////////////////////
boolean flag = true;
boolean flag1 = true;
boolean flag2 = true;
String sales[] = new String[5];
String orders[] = new String[5];
println("Welcome to our shop ");
do {
println("0 ) available products");
println("1 ) overview orders ");
println("2 ) overview sales ");
println("3 ) make new order ");
println("4 ) make new sale ");
println("5 ) return ");
int x = readInt("Click a number from 0-5 to choose what you want: ");
/////////////////////// switch of x starts here
switch (x) {
case 0:
for (int i = 0; i <= 25; i++) {
if (aItems[i] != null) {
if (i = 0) {
println("MOTHERBOARDS:");
}
if (i = 2) {
println("PROCESSORS:");
}
if (i = 4) {
println("GRAPHICS CARDS:");
}
if (i = 6) {
println("RAM MEMORIES:");
}
if (i = 8) {
println("HARD DRIVES:");
}
if (i = 10) {
println("MONITORS:");
}
if (i = 12) {
println("MOUSES:");
}
if (i = 14) {
println("KEYBOARDS:");
}
if (i = 16) {
println("PRINTERS:");
}
println(aItems[i]);
}
}
break;
case 4:
boolean flag3 = true;
while (flag3 == true) {
String kind2 = readLine("Do you want to sale hardware or peripheral product ? : ");
if (kind.equals("hardware")) {
String product = readLine("Do you want monitor ,mouse ,printer or keyboard ? : ");
if (product.equals("monitor")) {
println("We have 2 available monitors: ");
} else if (product.equals("mouse")) {
} else if (product.equals("printer")) {
} else if (product.equals("keyboard")) {
}
flag2 = false;
} else if (kind.equals("peripheral")) {
flag2 = false;
} else {
println("give the right type of product!!");
}
}
break;
switch (b) {
case 0:
println("The available Motherboards are:");
println(aItems[1]);
println(aItems[2]);
println("Enter on for first motherboard and 2 for the second motherboard: ");
int c = readInt("Enter number: ");
case 5:
flag = false;
break;
}
}
while (flag == true) ;
println("Have a nice day !!!");
}
}
}
}
忽略aItems以及我创建的硬件和外围设备类项目,它们都已编译并正常工作。但是,当我编译这个类时,它给了我错误,我不知道如何处理。请帮我。
顺便说一下,我必须说我通过cmd编译。