Question:
What's wrong with my Java program(Netbeans)?
davidfalsis
2009-08-30 02:27:55 UTC
Can someone please edit my codes. Everytime I run my program, the part where in you can choose the troubleshooting option(hardwawares) shows twice and how can I "JOptionPane" the part where I have to choose the monitor problems?

package davidfalsisss92;
import javax.swing.JOptionPane;
import java.util.Scanner;
public class Finals {

public static void main(String[] args) {
int option;
int monitorProblems;
int pictureSolution;
String hardware[] = {"1.) Monitor","2.) Mouse","3.) Hard drive","4.) Keyboard","5.) Unresponsive PC"};
String monitorTrouble[] = {"1.) I can't see anything on my monitor", "2.) The picture does not appear", "3.) The screen is not synchronized", "4.) The screen is not alligned", "5.) The screen settings is imbalanced"} ;
String monitorSolutions[] = {"Is the computer turned on? There is a light on the CPU. If the computer is on, it will be lit.", "Check to make sure that the computer signal; cable is finmly connected in the socket"} ;



JOptionPane.showMessageDialog(null,"Welcome To PC Calibrator");


JOptionPane.showInputDialog(null,"Please choose a troubleshooting option:\n1.) Monitor\n2.) Mouse\n3.) Hard drive\n4.) Keyboard\n5.) Unresponsive PC");
for(int i=0;i System.out.println(hardware[i]); }
Scanner scan = new Scanner(System.in);
option = scan.nextInt();
switch (option) {
case 1:
JOptionPane.showMessageDialog(null,"What is the problem of your monitor?");
for(int i=0;i System.out.println(monitorTrouble[i]); }
Scanner monitor = new Scanner(System.in);
monitorProblems = monitor.nextInt();
switch (monitorProblems) {
case 1:
JOptionPane.showMessageDialog(null,"-Is the computer turned on? There is a light on the CPU. If the computer is on, it will be lit." +
"\n*Power cord from the computer to the power strip." +
"\n*Power strip to the wall socket." +
"\n\n-Is the Power Strip turned on? There is a light on the strip. If the strip is on, the indictor light will be on." +
"\n\n-Is the Monitor on? There is a light on the monitor. If the monitor is on, it will be lit. If it is turned on, check the contrast and brightness buttons to see if they have been tampered with." +
"\n\n-Is the computer in Power Save or Sleep mode? Move the mouse or press any key on the keyboard to see if the computer will wake-up." +
"\n\n-Are all peripherals plugged in? Verify that all cables and cords leading in to and out of your computer to insure they are all in tight and not disconnected.");
break;
case 2:
JOptionPane.showMessageDialog(null,"Choose a solution");
for(int i=0;i System.out.println(monitorSolutions[i]); }
Scanner mSolutions = new Scanner(System.in);
pictureSolution = mSolutions.nextInt();
switch (pictureSolution) {
case 1:
JOptionPane.showMessageDialog(null,"It is!");
break;
case 2:
JOptionPane.showMessageDialog(null,"Ah, I see now, thank you sir^^");
break;
default:

}

break;
default:
}

}
}
}
Three answers:
ReanimateRaiObject
2009-08-30 02:39:03 UTC
try saving it on a txt file and post it on the additional info because part of the codes will be missing once you post this in yahoo answer.
meidinger
2016-10-07 03:13:33 UTC
i replaced into working as a commute author for a federal workplace. My interest replaced into to commute to all the tourism warm spots and consider out what replaced into universal, making the main money. To make an prolonged tale short, my boss heard a brilliant style of information approximately me and desperate that i replaced into purely the guy to go up a state commute analyze branch. i did no longer even know a thank you to do percents in 1971. I found out on my own to the quantity that i replaced right into a commute representative to 2 different states. I in no way found out Java and nonetheless can no longer discern it out. employ an expert.
Earth
2009-08-30 02:57:28 UTC
I don't know what are you trying to do! Is it a desktop application or console application?

BTW. your code even don't compile, because of the internal for loop where you re-declare 'int i'


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...