Explanation of Solution
Program:
File name: “BirthdayReminder.java”
//Import necessary header files
import java.util.*;
//Define a class named BirthdayReminder
public class BirthdayReminder
{
//Define main method
public static void main(String[] args)
{
//Declare the variables and initialize the values
final int NUM_NAMES = 10;
String sentinal = "ZZZ";
int count = 0;
String name = null;
String birthdate = null;
//Declare an array of values
String[] names = new String[NUM_NAMES];
String[] birthdates = new String[NUM_NAMES];
//Create an object for Scanner class
Scanner input = new Scanner(System.in);
//Prompt the user to enter a name
System.out.println("Enter a name or " + sentinal + " to quit > ");
name = input.nextLine();
/*While condition to check if the user enters the sentinel value ZZZ for a name or has entered 10 names*/
while(name.compareTo(sentinal)!=0 && count < NUM_NAMES)
{
//Prompt the user to enter the birthdate
System.out.println("Enter birthdate (mm/dd) > ");
birthdate = input.nextLine();
//Store the count of names and birthdate entered
names[count] = name.trim();
birthdates[count] = birthdate.trim();
//Prompt the user to enter a name
System.out.println("Enter a name or " + sentinal + " to quit > ");
name = input.nextLine();
//Increment the count
++ count;
}
//Print the result
System.out.println("\nCount of names is " + count);
System.out.println("\nNames are:" + count);
//For loop is executed until x exceeds count
for(int x = 0; x < count; ++x)
//Print the result
System.out.println(names[x]) ;
//Declare boolean variables and initialize the value
boolean repeat = true;
boolean found;
//While condition to repeat the loop
while(repeat)
{
//Assign false value to found
found=false;
//Prompt the user to enter a name
System...
Trending nowThis is a popular solution!
- Java Write an application that allows a user to enter the names and birthdates of up to 10 friends. Continue to prompt the user for names and birthdates until the user enters the sentinel value ZZZ for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birthdate or "Sorry, no entry for name" if the name has not been previously entered. The loop continues until the user enters ZZZ for a name.arrow_forwardPlease solve this using java Write an application that allows a user to enter the names and birth dates of up to 10 friends. Continue to prompt the user for names and birth-dates until the user enters the sentinel value “ZZZ” for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birth-date or an error message if the name has not been previously entered. The loop continues until the user enters “ZZZ” for a name.arrow_forwardWrite an application that prompts a user for two integers and displays every integer between them. Display There are no integers between X and Y if there are no integers between the entered values. Make sure the program works regardless of which entered value is larger.arrow_forward
- Create a C++ hotel reservation program with a class that ask the user to enter a room number, enter the daily rate, the number of guests to occupy a room and also change the status of the room to reflect the number of guests that just checked in. Additionally, implement a loop asks the user if they want to search for a different room number, if they enter 'yes' then it should allow them to start over and enter another different room numbwr. Display the information about the room in a nice format. The output should look something like this: Please enter the room number: 104 Please enter the number of guests: 10 Enter the daily rate: $150 Room number: 104 Guests in the room: 4 Room status: 4 occupants Daily rate: $300 Would you like to search for another room number ? Yes/Noarrow_forwardWrite a program that generates a random number in the range of 1 through 100, and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over. Additional Enhancement: Enhance the game so it keeps count of the number of guesses that the user makes. When the user correctly guesses the random number, the program should display the number of guesses.arrow_forwardWrite an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.arrow_forward
- Create a C++ hotel reservation program with a class that ask the user to enter a room number, the number of guests to occupy a room and also change the status of the room to reflect the number of guests that just checked in. Additionally, implement a loop asks the user if they want to search for a different room number. Display the information about the room in a nice format. The output should look something like this: Please enter the room number: 104 Please enter the number of guests: 10 Room number: 104 Guests in the room: 4 Room status: 4 occupants Would you like to search for another room number ? Yes/Noarrow_forwardWrite a program that generates a random number in the range of 1 through 1000, and asks the user to guess what the number is. If the user guess is higher than the random number, the program should display Too high, try again. If the users guess is lower than the random number, the program should display Too low, try again. If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over. If the user doesn't want to continue the game the user should type an appropriate stop symbol to terminate the program (such stop conditions were discussed in the class). For each game iteration, count the number of guesses made by the user and display them. The program should contain the following functions: check_guess(): this function checks if the user's guess is lower, higher or equal to the random number. random_gen(): function that generates one random number for one game iteration main(): the function where the program…arrow_forwardCreate an application that random 2 integers from 0 to 100. If a%b==0 print a/b, else rerollarrow_forward
- Starting with the following code, add a loop that will prompt the user for the number of math questions the user would like to be presented with: import randomfirstnum = random.randrange(1,11) # return an int from 1 to 10secondnum = random.randrange(1, 11)compsum = firstnum + secondnum # adds the 2 random numbers together# print (compsum) # print for troubleshootingprint("What is the sum of", firstnum, " +", secondnum, "?") # presents problem to useradded = int(input("Your answer is: ")) # gets user inputif added == compsum: # compares user input to real answer print("You are correct!!!")else: print ("Sorry, you are incorrect")arrow_forwardWrite a program that asks the user to enter 10 numbers, that range from 10-100. Make sure that you do not accept any numbers less than 10, if a user enters a number that is less than 10 then ask him again. Once the user enters all 10 numbers, sort the numbers entered in ascending order and print them out. CSharparrow_forwardWrite a program that asks a user to enter a first name, a last name, and a year, andconstruct an account ID in the format of:firstname.lastnameYYwhere the field “firstname” is user’s first name allowing no more than (first) five letters;the field “lastname” is user’s last name allowing no more than (first) six letters; and thefiled “YY” is the lower two digits of the year. For example:first name entered: Michaellast name entered: Richmondyear entered: 1985 the constructed account ID will be: Micha.Richmo85arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage