Collecting Information 01/26/2018 at 11:55PM Objective: Write a program that pro
ID: 3877903 • Letter: C
Question
Collecting Information 01/26/2018 at 11:55PM Objective: Write a program that prompts the user for important information, and then prints that information to the console. The information that should be collected includes: e Name . Age . Height (in meters) . Blood Type . Cat person (true or false) . Dog person (true or false) . Are they a shape shifting reptilian (true or false) . Amount of gold buried on their land (in kilograms) Example Dialog: Welcome to the super important information collection system 2600 Enter your name Bob Enter your age 28 Enter your height (in meters) 1.68 Enter your blood type 0+ Are you a cat person? True or False true Are you a dog person? True or False true Are you a reptilian shape shifter? True or False false How much gold do you have buried on your property? In kilograms 4.5 Name: Bob Age: 28 years old Height: 1.68m Blood Type: 0+ Cat Person true Dog person: true Reptilian Shape Shifter: false Amount of gold buried on land: 4.5kgExplanation / Answer
Hi.. I have written java program to collect information. Please check below program.
Prompt.java
import java.util.Scanner;
public class Prompt {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("Welcome to the super important information collection system 2600.");
System.out.println("Enter your name");
String name="";
while(name.isEmpty()){
name = sc.nextLine();
if(!name.isEmpty())
break;
}
int age = 0;
System.out.println("Enter your age");
age = sc.nextInt();
double height=0.0;
System.out.println("Enter your height (in meters)");
height = sc.nextDouble();
String bloodGroup="";
System.out.println("Enter your blood type");
while(bloodGroup.isEmpty()){
bloodGroup = sc.nextLine();
if(!bloodGroup.isEmpty())
break;
}
String catPerson="";
System.out.println("Are you a cat person? True or False");
while(catPerson.isEmpty()){
catPerson = sc.nextLine();
if(!catPerson.isEmpty())
break;
}
String dogPerson="";
System.out.println("Are you a dog person? True or False");
while(dogPerson.isEmpty()){
dogPerson = sc.nextLine();
if(!dogPerson.isEmpty())
break;
}
String rep="";
System.out.println("Are you a reptilian shape shifter? True or False");
while(rep.isEmpty()){
rep = sc.nextLine();
if(!rep.isEmpty())
break;
}
double km=0.0;
System.out.println("How much gold do you have buried on your property? In kilograms");
km = sc.nextDouble();
System.out.println(" Name: "+name);
System.out.println("Age: "+age+" years old");
System.out.println("Height: "+height+"m");
System.out.println("Blood Type: "+bloodGroup);
System.out.println("Cat person: "+catPerson);
System.out.println("Dog person: "+dogPerson);
System.out.println("Reptilian shape shifter: "+rep);
System.out.println("Amount of gold buried on land: "+km);
}
}
Output:
Welcome to the super important information collection system 2600.
Enter your name
Bob
Enter your age
283
Enter your height (in meters)
2.36
Enter your blood type
O+
Are you a cat person? True or False
true
Are you a dog person? True or False
true
Are you a reptilian shape shifter? True or False
false
How much gold do you have buried on your property? In kilograms
3.25
Name: Bob
Age: 283 years old
Height: 2.36m
Blood Type: O+
Cat person: true
Dog person: true
Reptilian shape shifter: false
Amount of gold buried on land: 3.25
Please check the above code and let me know any issues. Thank you. All the best.