• Log in or sign up for an account here: https://www.sythe.org/login

need help with school project

dogoncouch

Forum Addict
Joined
Apr 6, 2007
Sythe Gold
0
Messages
401
nvm guys got it all figured out. anyway check out this script


import TerminalIO.KeyboardReader;
/**
*so excited
*it is a script!!
*/
public class program3
{
public static void main (String [] args)
{
KeyboardReader keyboard = new KeyboardReader();
System.out.println("This program allows the user to type in ansers.");
System.out.println("What is your name?");
String name;
name=keyboard.readLine();
System.out.println("Well, hello "+name+" ");
System.out.println("What is your favorite color?");
String color;
color=keyboard.readLine();
System.out.println("Well, "+name+" my favorite color is not "+color+" but that is okay");
System.out.println(name+" what is your favorite food?");
String food;
food=keyboard.readLine();
System.out.println("Now "+food+" is tottaly awesome dude");
System.out.println(name+" what is your favorite band?");
String band;
band=keyboard.readLine();
System.out.println(band+" is the coolest i wish i could listen to that music ");
System.out.println(name+" what kind of car do you have?");
String car;
car=keyboard.readLine();
System.out.println(car+" hmm. well i wish i could drive a car");
System.out.println("Well "+name+" what is your favorite genre of music?");
String music;
music=keyboard.readLine();
System.out.println(music+" is awesome i listen to it a lot!");
System.out.println("What kind of job do you want "+name+" ?");
String job;
job=keyboard.readLine();
System.out.println(job+" sounds like a good job");
System.out.println("What is your favorite number?");
String number;
number=keyboard.readLine();
System.out.println("Wow, "+number+" is my favorite also");
System.out.println("What color house do you have?");
String house;
house=keyboard.readLine();
System.out.println(house+" is a nice color for a house");
System.out.println("What is your favorite type of pet?");
String pet;
pet=keyboard.readLine();
System.out.println(pet+" would be nice to own");
System.out.println("What is your favorite drink "+name+"? ");
String drink;
drink=keyboard.readLine();
System.out.println("Mmm "+drink+" is really good.");

System.out.println("Now, let's ask some questions using numbers.");
double num1, num2, sum, difference, product, quotient;

System.out.println("Please enter a number:");
num1=keyboard.readDouble();
System.out.println("Please enter another number:");
num2=keyboard.readDouble();

sum=num1+num2;
difference=num1-num2;
product=num1*num2;
quotient=num1/num2;

System.out.println("The sum of "+num1+" and "+num2+" is "+sum);
System.out.println("The difference of "+num1+" and "+num2+" is "+difference);
System.out.println("The product of "+num1+" and "+num2+" is "+product);
System.out.println("The quotient of "+num1+" and "+num2+" is "+quotient);

System.out.println("");
System.out.println("");
System.out.println("This section of the program will be computing famous geometric formulas");

System.out.println("");
System.out.println("#1: area of a rectangle: a = b * h");
double base=0, height=0, areaRectangle=0;
System.out.println("Please enter the base:");
base=keyboard.readDouble();
System.out.println("Please enter the height");//may need : after height
height=keyboard.readDouble();

areaRectangle = base * height;
System.out.println("The area of a rectangle with base "+base+" and height "+height+" is "+areaRectangle);

System.out.println("");
System.out.println("");
System.out.println("Area of a triangle: A = 1/2 * b * h");
System.out.println("Please enter the base:");
base=keyboard.readDouble();
System.out.println("Please enter a height");
height=keyboard.readDouble();
double areaTriangle=0;
areaTriangle = 0.5 * base * height;
System.out.println("The area of the triangle with base "+base+" and height "+height+" is "+areaTriangle);

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

}
}
 
Runescape Gamblingrunescape gambling
Back
Top