Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by pblake ( 5 years ago )
/**
 * This code prompts the iuser for 3 different strings and places them in a print line.
 * 2/22/21
 * @pblake
 */

import java.util.Scanner; //this imports code, so we can accept user input

public class Prompt3
{
    public static void main(String[] args)
    {
        //Prompt for Weekday
        System.out.println("What day of the week is it?");
        Scanner in = new Scanner(System.in); //required for input (just do this once)
        String weekDay = in.nextLine(); //stores input to variable weekDay
        //Prompt for weather
        System.out.println("Please enter the weather");
        String weather = in.nextLine();
        //Prompt for temp
        System.out.println("Please enter the temperature");
        String temp = in.nextLine();
        
        System.out.println("Today is " + weekDay + " it is " + weather + " outside ");
        System.out.println("The current temperature outside is " + temp + " degrees");
    }
}

 

Revise this Paste

Your Name: Code Language: