need help with school project

Discussion in 'Programming General' started by dogoncouch, Nov 6, 2007.

need help with school project
  1. Unread #1 - Nov 6, 2007 at 2:20 PM
  2. dogoncouch
    Joined:
    Apr 6, 2007
    Posts:
    401
    Referrals:
    0
    Sythe Gold:
    0

    dogoncouch Forum Addict
    Banned

    need help with school project

    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("");

    }
    }
     
< i need RS map and hs help :P | How do you write a program that opens images? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site