Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program that asks the user \"How high should I count\" and stores the us

ID: 3822742 • Letter: W

Question

 write a program that asks the user "How high should I count" and stores the user's response in a primitive integer value. Next, the program should declare a reference to a date object called startTime. The program should instantiate a Date object referrred to by StartTime which represents the current time. Next, write an empty for loop which executes as many times as specified by the user and does not generate any output. Once the for loop program should instantiate a Date object called finishTime. The program should instantiate a Date object referred to by finishTime which represents the Current time. Using calls to get time method of the date class, compute and display the number of milliseconds that elapsed between startTime and finishTIme 

Explanation / Answer

public class {
  
public static void main(String[] args) {
  
String name; // The user's name.
String email; // The user's email address.
double salary; // the user's yearly salary.
String favColor; // The user's favorite color.

  
TextIO.putln("Good Afternoon! This program will create");
TextIO.putln("your profile file, if you will just answer");
TextIO.putln("a few simple questions.");
TextIO.putln();
  
/* Gather responses from the user. */
  
TextIO.put("What is your name? ");
name = TextIO.getln();
TextIO.put("What is your email address? ");
email = TextIO.getln();
TextIO.put("What is your yearly income? ");
salary = TextIO.getlnDouble();
TextIO.put("What is your favorite color? ");
favColor = TextIO.getln();
  
/* Write the user's information to the file */
  
TextIO.writeFile("profile.txt"); // subsequent output goes to file
TextIO.putln("Name: " + name);
TextIO.putln("Email: " + email);
TextIO.putln("Favorite Color: " + favColor);
TextIO.putf( "Yearly Income: %,1.2f%n", salary);

/* Print a final message to standard output. */
Date startTime = new GregorianCalendar(2014, Calendar.FEBRUARY, 11).getTime();
  
TextIO.writeStandardOutput();
TextIO.putln("Thank you. Your profile has been written to profile.txt.");
  
}
  
}