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!

Chapter 8 Solutions
MINDTAPV2.0 JAVA PROGRAMMING 2021, 1TERM
- Exercise 1 Function and Structure [30 pts] Please debug the following program and answer the following questions. There is a cycle in a linked list if some node in the list can be reached again by continuously following the next pointer. #include typedef struct node { int value; struct node *next; } node; int 11_has_cycle (node *first) if (first == node *head { NULL) return 0;B = first; while (head->next != NULL) { if (head == first) { return 1; } head head->next; } return 0; void test_11_has_cycle() { int i; node nodes [6]; for (i = 0; i < 6; i++) nodes [i] .next = NULL; nodes [i].value i; } nodes [0] .next = &nodes [1]; nodes [1] .next = &nodes [2]; nodes [2] .next = &nodes [3]; nodes [3] .next = & nodes [4]; nodes [4] .next = NULL; nodes [5] .next = &nodes [0]; printf("1. Checking first list for cycles. \n Function 11_has_cycle says it hass cycle\n\n", 11_has_cycle (&nodes [0]) ?"a":"no"); printf("2. Checking length-zero list for cycles. \n Function 11_has_cycle says it has %s…arrow_forwardcheckpoint exercice for my students for Amortized Analysisarrow_forwardusing r languagearrow_forward
- using r languagearrow_forwardusing r languagearrow_forwardCompute a Monte Carlo estimate o of 0.5 0 = L ē -xdx 0 by sampling from Uniform(0, 0.5). Find another Monte Carlo estimator 0* by sampling from the exponential distribution. Use simulations to estimate the variance of Ô and ⑦*, which estimator has smaller variance?arrow_forward
- import tkint class ShowInfoGUI:def __init__(self):# Create the main windowself.main_window = tkinter.Tk() # Create two framesself.top_frame = tkinter.Frame(self.main_window)self.bottom_frame = tkinter.Frame(self.main_window)arrow_forwardJOB UPDATE Apply on- COMPANY VinkJobs.com @ OR Search "Vinkjobs.com" on Google JOB PROFILE JOB LOCATION INTELLIFLO APPLICATION DEVELOPER MULTIPLE CITIES GLOBAL LOGIC SOFTWARE ENGINEER/SDET DELHI NCR SWIGGY SOFTWARE DEVELOPMENT BENGALURU AVALARA SOFTWARE ENGINEER (WFH) MULTIPLE CITIES LENSKART FULL STACK DEVELOPER MULTIPLE CITIES ACCENTURE MEDPACE IT CUST SERVICE SOFTWARE ENGINEER MUMBAI MUMBAI GENPACT BUSINESS ANALYST DELHI NCR WELOCALIZE WORK FROM HOME MULTIPLE CITIES NTT DATA BPO ASSOCIATE DELHI NCRarrow_forwardHow can predictive and prescriptive modeling be used to measure operational performance in real-time? Do you see any potential downsides to this application? Can you provide an example?arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning




