Menu

[Solved]Develop Program First Requests User Supply First Name Reading First Name Program Requests Q37294969

Develop a program that first requests its user to supply a firstname. After reading the first name, the program requests its usersupply an age. After reading the age, the program prints out atasteful complement based on the supplied age and personallyaddresses the user by name.

The compliment must indicate that the user looks an age that isbetween two – five years less than the supplied age. A randomnumber generator object will be used to generate the number tosubtract from the user’s supplied age. I was wondering if someonecould assist me with this java assignment

Here is what I have

import java.util.Random;

import java.util.*;

public class Compliment {

public static void main(String[] args) {

age(null);

Scanner console= new Scanner(System.in);

}

public static void age (Scanner console) {

System.out.println(“Enter your name:”);

System.out.println();

String name=console.nextLine();

System.out.println(“Name is: ” + name);

System.out.println();

   System.out.println(“Enter your age:”);

    int age=console.nextInt();

Random rand = new Random();

int randomAge = rand.nextInt(9);

int compAge= age-randomAge;

System.out.println(“Come on” + name + “you don’t even look like”+ compAge);

}

}

Expert Answer


Answer to Develop a program that first requests its user to supply a first name. After reading the first name, the program request… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *