Results 1 to 4 of 4
  1. #1
    yair's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    50
    Reputation
    10
    Thanks
    1

    Angry need some really quick help

    1. Create a class called ValentinesDay

    2. Declare the following 6 variables, choosing the appropriate data type. Must use at least one of each data type listed here: String, int, double, char, boolean [2 pts]

    datesName
    gender (must be single character, m=male, or f=female)
    restaurauntName
    numberOfRoses
    totalSpent
    feelingLucky

    3. Using the Scanner class, prompt the user to enter the values for ALL the variables. [2 pt] (Note: If you decide to just hard-code the values only and not read keyboard input, then you can earn 1 point)

    4. Print all the info about your Album to the screen, similarly as follows [1 pt]

    Example Interaction with Program: (the blue text represents keyboard input)
    What is your dates name?
    Oprah
    What gender is your date?
    f
    Where are you taking your date?
    McDonalds
    How many roses are you bringing?
    1
    How much do you plan on spending?
    12.50
    Are you feeling lucky?
    true

    Example Output:
    ------------------------------------
    My Valentines Day Details:
    -------------------------------------
    Name: Oprah
    Gender: f
    Place: McDonalds
    Number of Roses: 1
    Total Spent: $12.50
    Got Lucky: true
    -------------------------------------

    here is what i have so far....sorry i dont post in correct format


    import java.util.Scanner;
    import javax.swing.JOptionPane;

    public class VelentinesDate {

    public static void main(String[] args)
    {

    Scanner keyboard = new Scanner(System.in);
    double totalSpent;
    int numberOfRoses ;
    char ;
    String datesName1, restaurantName ;



    System.out.println("What is your dates name?");
    datesName1 = keyboard.next();
    System.out.println("What gender is your date?");

    System.out.println("Where are you taking your date?");
    restaurantName = keyboard.next();
    System.out.println("How many roses are you bringing?");
    numberOfRoses = keyboard.nextInt();
    System.out.println("How much do you plan on spending?");
    totalSpent = keyboard.nextDouble();

    Boolean lucky = true ;



    System.out.println("Are you feeling lucky?");

    }


    }

  2. #2
    FLubz's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    L3 Cache
    Posts
    39
    Reputation
    10
    Thanks
    6
    My Mood
    Cool
    Assuming that, that is homework, you should at least try to understand what that code does, well anyways,
    here's teh codes

    ValentinesDay.java
    Code:
    import java.util.Scanner;
    //import javax.swing.JOptionPane;
    
    public class ValentinesDate {
    
    	public static void main(String[] args)
    	{
    		//using at least one of each type listed below:
    		//String used 4 times
    		//int used once
    		//double used once
    		//char used once
    		//boolean used once
    		Scanner keyboard = new Scanner(System.in);
    		double totalSpent;
    		int numberOfRoses ;
    		char gender;
    		boolean lucky;
    		String datesName1, restaurantName, feelinglucky ;
    
    		System.out.println("What is your dates name?");
    		datesName1 = keyboard.next();
    		System.out.println("What gender is your date?");
    		String sGender = keyboard.next();
    		gender = sGender.charAt(0);
    		System.out.println("Where are you taking your date?");
    		restaurantName = keyboard.next();
    		System.out.println("How many roses are you bringing?");
    		numberOfRoses = keyboard.nextInt();
    		System.out.println("How much do you plan on spending?");
    		totalSpent = keyboard.nextDouble();
    		System.out.println("Are you feeling lucky?");
    		feelinglucky = keyboard.next();
    		
    		if (feelinglucky.equals("true"))
    			lucky=true;
    		else
    			lucky=false;
    		
    		System.out.println("Name: "+datesName1);
    		System.out.println("Gender: "+gender);
    		System.out.println("Place: "+restaurantName);
    		System.out.println("Number of Roses: "+numberOfRoses);
    		System.out.println("Total Spent: $"+totalSpent);
    		System.out.println("Got Lucky: "+lucky);
    	}
    }
    Example Usage:

    Input:

    What is your dates name?
    Oprah
    What gender is your date?
    f
    Where are you taking your date?
    McDonalds
    How many roses are you bringing?
    1
    How much do you plan on spending?
    12,50 //had to use the comma , cuz in germany we have different conventions
    Are you feeling lucky?
    true

    Output:

    Name: Oprah
    Gender: f
    Place: McDonalds
    Number of Roses: 1
    Total Spent: $12.5
    Got Lucky: true


    ---------- Post added at 08:04 PM ---------- Previous post was at 08:02 PM ----------

    I do not like how it is programmed since it's forbidden to be more object oriented :S I would put all that input and output functions into seperate methods, but .. ye
    Quote Originally Posted by 258456 View Post
    I was aimbotting people while i was in the wall and i didn't get banned.

  3. The Following User Says Thank You to FLubz For This Useful Post:

    yair (02-21-2012)

  4. #3
    yair's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    50
    Reputation
    10
    Thanks
    1
    thats pretty cool thanks man...but i figured it out before you got to it...

  5. #4
    FLubz's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    L3 Cache
    Posts
    39
    Reputation
    10
    Thanks
    6
    My Mood
    Cool
    Good for you :=)
    Quote Originally Posted by 258456 View Post
    I was aimbotting people while i was in the wall and i didn't get banned.

Similar Threads

  1. Need Some on To help me witrh D3D.
    By 4chan in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 8
    Last Post: 09-04-2010, 01:35 AM
  2. Need some one to help me
    By 1kshedd in forum Combat Arms Help
    Replies: 1
    Last Post: 07-03-2010, 10:08 PM
  3. Hi i need your help i need some moder to help for this
    By TheAvenger in forum Combat Arms Help
    Replies: 1
    Last Post: 04-16-2010, 12:04 PM
  4. i need some hacker's help.
    By Weed Farmer™ in forum General
    Replies: 3
    Last Post: 09-04-2009, 10:01 AM
  5. need some ppl to help me make blackdrag0 v5.0-v6.0!!!
    By blackdrag0 in forum WarRock - International Hacks
    Replies: 10
    Last Post: 05-30-2007, 07:51 AM