Answered You can hire a professional tutor to get the answer.

QUESTION

Develop a program that first requests its user to supply a first name. After reading the first name, the program requests its user supply an age.

Develop a program that first requests its user to supply a first name. After reading the first name, the program requests its user supply an age. After reading the age, the program prints out a tasteful complement based on the supplied age and personally addresses the user by name.

The compliment must indicate that the user looks an age that is between two - five years less than the supplied age. A random number generator object will be used to generate the number to subtract from the user's supplied age. I was wondering if someone could assist me with this 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);

}

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question