Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using C++ Problem A: Birthday Hooray (20 points) Write a program that lets the user enter a list of birthdays. Data will be entered into
using C++
Problem A: Birthday Hooray (20 points) Write a program that lets the user enter a list of birthdays. Data will be entered into the program in the following format: mm/dd/yyyy (meaning month, day, year) So 2/25/2021 would mean someone has a birthday on February 25th, 2021. The user will type one date in this format per line until they wish to stop. To denote "stop" the user will enter a -1 on it's own line. When the month is entered as - 1 (without a further day-or-month or year) stop reading input extract the following two statistics: 1. the most common day-of-month 2. the month with the most people born. You can assume that at least one date is always entered, and we will not test for a case where there is a tie, so you can reasonably resolve ties in any way. Hints and Notes: Because we did not list any upper limit on inputs, do not assume any upper limit. You will need to find a way to store the information needed without storing all the birthdays in one giant array. Processing the input to check for -1 (stop) should use the same cin trick we've seen in the last two homework. If you did string parsing or struggled with that trick in the past two homework let us know and we can try to walk you through it. Think carefully about how much, and what, data we need to store as we read these inputs. Once you know what variables you need you have the basic structure of the whole algorithm. Don't start coding the problem if you don't actually see how to solve it. Like the previous homework - bugs in your code can lead to an infinite loop (or to your program waiting forever for input that will not be given). If either of these happen this will be considered a critical error in your code, and is not the fault of the testing software. Examples and format demonstration Follow the format shown in the examples exactly. Otherwise the grading program will not be able to understand your final answer. Example 1 (user input is underlined for clarity, underlined text in your program is not needed). Further note that PDFs will sometimes use 2 spaces where our code only uses 1. (In general I do not recommend copy/pasting from PDFS) Gimme dates! 2/25/2021 -1 Most common day: 25 Most common birth month: 2 Example 2 (user input is underlined for clarity, underlined text in your program is not needed). Further note that PDFs will sometimes use 2 spaces where our code only uses 1. (In general I do not recommend copy/pasting from PDFS) Gimme dates! 1/2/3 3/2/1 3/1/2 -1 Most common day: 2 Most common birth month: 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started