Jump to content

My Java Program


Guest h4344

Recommended Posts

Posted

This is what i have so far:

 

 

import java.util.Scanner;

 

public class Test {

 

public static void main(String []args) {

 

Scanner scan = new Scanner(System.in);

double answer = 0;

 

System.out.println("-----------------");

System.out.println("Created By h4344");

System.out.println("-----------------");

 

while (answer != 4){

 

double fnum = 0, snum = 0;

System.out.println("What 2 numbers = 4?");

System.out.println("Enter First Number: ");

fnum = scan.nextDouble();

System.out.println("Enter Second Number: ");

snum = scan.nextDouble();

answer = fnum + snum;

 

 

if(answer == 4) {

System.out.println(answer);

System.out.println("Your Answers Were Correct");

System.out.println("Done!");

}

else{

System.out.println(answer);

System.out.print("Your Answers Were Wrong!");

System.out.println("Try Again!");

System.out.println();

}

}

 

}

 

}

 

Working on making it a simple math program but looking good so far. Ty to Capt.Xander for helping me out with some of the lines. :D

Guest MAJ.Spartan-S63=US=
Posted
It would help if you used the code tags to wrap the code. But it looks like a cool Java program. We'll have to get together sometime so I can teach you more.
Posted
I might need your help with something if you get the time.
Posted

Realy good. Programming is learning for all your life. The beginnings are difficult, but the reward is beautiful.

 

Btw, I would like to join to your lessons.

  • 2 weeks later...
Guest mbradley672
Posted
Nice work. I'm actually a C# developer but do have experience with Java and would also love to help anyone out there that woudl like to learn either.
Guest Ret.Maj.Xander=US=
Posted

you can use the {code} tags (use '[ ]' instead of '{ }')in the forum and that will stay formatted like so

 

import java.util.Scanner;

public class Test {

public static void main(String []args) {

	Scanner scan = new Scanner(System.in);
	double answer = 0;

	System.out.println("-----------------");
	System.out.println("Created By h4344");
	System.out.println("-----------------");

	while (answer != 4){

		double fnum = 0, snum = 0;
		System.out.println("What 2 numbers = 4?");
		System.out.println("Enter First Number: ");
		fnum = scan.nextDouble();
		System.out.println("Enter Second Number: ");
		snum = scan.nextDouble();
		answer = fnum + snum;


		if(answer == 4) {
			System.out.println(answer);
			System.out.println("Your Answers Were Correct");
			System.out.println("Done!");
		}
		else{
			System.out.println(answer);
			System.out.print("Your Answers Were Wrong!");
			System.out.println("Try Again!");
			System.out.println();
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...