well first I would like to say well come to java programming.
secondly can every one use the
reply with quotes to see me
third here is your code back with some line edits it does not work yet but if you see what i am doing
use your output statements
System.out.println("I got to this spot"); // semi colon =)
then you should be able to finish nicely.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package junkcode;
import javax.swing.JOptionPane;
/**
*
* @author William
*/
public class MiniLab4 {// class Name will begin with a Capital Letter.
public static void main(String[] args) {
body();
closingMessage();
/****** you don't need this at all ****/
//system.exit(0); //<-- says right here ';' expected
} // end main
public static void closingMessage() {
JOptionPane.showMessageDialog(null, "Good job, have a nice day!", "Exit window", JOptionPane.INFORMATION_MESSAGE);
}
public static void openingMessage() {
JOptionPane.showMessageDialog(null, "Welcome to the X viewer", "Opening Window", JOptionPane.INFORMATION_MESSAGE);
}//opening message
public static void body() {
openingMessage();
getInt();
}
/**
* what is the difference between getInt(String[] args) and getInt() ???
* @param args
* @return
*/
public static int getInt(String[] args) {
int x;
x = getInt();
System.out.println("You entered " + x + ".");
//missing return statement
return x;
} // main
public static int getInt() {
int val;
//very bad way to start a while loop it forced use do while loop
// do things then while its true continue it removed the break statement
while (true) // a seemingly endless loop - uses break to get out
{ // loop until we get a valid int
String s = JOptionPane.showInputDialog("Enter a whole number:");
if (s == null) {
JOptionPane.showMessageDialog(null, "Leaving program"); // exit on cancel
System.exit(0);
} // cancel if
else if (s.equals("")) {
JOptionPane.showMessageDialog(null, "You must make an entry in the InputBox");
} // entered nothing
try {
val = Integer.parseInt(s);
break; // exit loop with valid int
// could have had a variable change here to get out of loop
}// try
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Enter a whole number");
}// catch
// well first we need to figure what number and times are then we can decide wheather we can
// create a argument for it.
//I want number to be 0 and times 1 then its always true
int number = 0;
int times = 1;
while (number <= times) {
xFig();
System.out.println("Hey do I work??? ");//<--- finish this statement was --> System.out.println
number = number++ /* guess you don't like semi colons */ ;
// 1; <---- what is this??
}
} // while
return val; //return the number to the calling method
} //end getInt
public static void bottom() {
System.out.println(" **** ****");
System.out.println(" **** ****");
System.out.println(" **** ****");
System.out.println(" **** ****");
System.out.println(" *******");
System.out.println(" *****");
System.out.println(" ***");
}//top figure
public static void top() {
System.out.println(" ***");
System.out.println(" *****");
System.out.println(" *******");
System.out.println(" **** ****");
System.out.println(" **** ****");
System.out.println(" **** ****");
System.out.println(" **** ****");
}// bottom figure
public static void blank() {
System.out.println("");
} // blank
public static void xFig() {
bottom();
top();
}
}
good luck if you get stuck throw a reply