A program that will prompt the user for a date and a time

Assignment Help Basic Computer Science
Reference no: EM13861095

It's to be written in C++. You will be writing a program that will prompt the user for a date and a time. For the date, the user will be asked to enter in three integers (month, day, year). There will be four functions related to the date:

1.string getMonth() - Prompts the user for an integer resembling the month.

The function should then check the integer value and return the string

correlated to the month.

2.int getDay() - Prompts the user for an integer resembling the day and returns

the integer.

3.int getYear() - Prompts the user for an integer resembling the year and returns

the integer.

4.void displayDate(string month, int day, int year) - Displays the date in this

format: October 18, 2012

Next, the user will be asked to enter the time, which is to be then converted from military time and displayed. There will be three functions related to the time:

int getHours() - Prompts the user for an integer resembling the hour of the day in military time. If the user enters 23, the function should return 11. If the military time entered is >=12, set the global boolean variable PM to be true, else false. int getMinutes() - Prompts the user for an integer resembling the minutes and returns that integer. void displayTime(int hour, int min) - This function will check if the global boolean variable PM is true. If it is true, display the time in this format: 12:34 PM. If PM is false, display the time as so: 11:34 AM

For each "get" function, there should be an input-validation loop. The purpose for this lab is to allow you to become more comfortable with declaring functions, calling functions, and defining functions.

The output should be similar to the following:

Please enter in the month: 10

Please enter the day of the month: 18

Please enter the year: 2012

Please enter the hour in military format: 23

Please enter the number of minutes: 34

Reference no: EM13861095

Questions Cloud

What is the formula for finding omitted : What is the formula for finding omitted variable bias with multiple regressors?
Deacon publishing house is a publishing company : Deacon Publishing House is a publishing company that produces consumer magazines. The house and home division which sells home improvement and home decorating magazines, has seen a 20% reduction in operating income over the past nine months, primaril..
Describe the difference between classes and objects : Please describe the difference between classes and objects. How are they related? What does it mean to instantiate an object? Also, please describe the difference between composition and aggregation and when it is better to use one over the other?
Prompts the user for a hexadecimal digit : Write a MIPS program that prompts the user for a hexadecimal digit and then displays the decimal equivalent multiplied by 2. For example, the program displays 10 for hex '5', 20 for 'A', etc. If the user enters an invalid value, the program should di..
A program that will prompt the user for a date and a time : It's to be written in C++. You will be writing a program that will prompt the user for a date and a time. For the date, the user will be asked to enter in three integers (month, day, year). There will be four functions related to the date:
Sample the dribbling to extract its frequency : Consider a basketball being dribbled. If the height of the basketball can be described by a sine wave of maximum height 2h, average height h and minimum height 0, and the ball hits the ground once per second, how fast would a video camera have to sam..
What are your thoughts about your results : What are your thoughts about your results?  What are you feelings towards this assignment?  How would you improve it? Submit this with your assignment.
Know how to process command line arguments : Through this programming assignment, the students will learn to do the following: Know how to process command line arguments. Perform basic file I/O.
Theater seating revenue with input validation : Theater Seating Revenue with Input Validation: A dramatic theater has three seating sections, and it charges the following prices for tickets in each section:  Section A seats cost $20 each

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Function creates and returns 1d list of final prices

Write a functon def final_price_list(inventory, row, col) that has 3 parameters - 2D list described above, number of rows and number of columns. Function creates and returns 1D list of final prices for all items after discount is applied. Assume t..

  How i should write out the source file

Given struct vector scale_vector (struct vector v, double scalar) for the header file.

  Intermediate steps for a translation

How the results and intermediate steps for a translation of (20,40,-10), a rotation of 135 degrees about the z-axis applied to a starting point of (45,-95,20). Perform a separate operation applying scale with scale factors of sx=2.0, sy=1.6 and sz..

  Describe the multicultural and multinational issues

Describe the multicultural and multinational issues surrounding information security and describe the security challenges presented when an organization has multiple directors leading information technology departments.

  Create an empty set

create an empty set. use a loop to add 10 random integers, all from 10 to 30 inclusive, to the set.

  Write a program that generates a sequence of 20 random value

write a program that generates a sequence of 20 random values between 0 and 99, prints the sequence, sorts it, and prints the sorted sequence. use the sort function form the standard C++ library.

  Draw a hierarchy diagram

Draw a hierarchy diagram (be sure to include Attributes and Methods)

  Define peas for your improved agent x design.

Define PEAS for your improved Agent X Design.

  What are the skills related to it auditing?

What are the skills related to IT Auditing? List and describe 3 areas

  Promote travel programs hosted by the library

As a volunteer at your local public library, you are helping to promote travel programs hosted by the library. The head librarian has created a document with specifics for an upcoming program called Timeless Travel Tips.

  Find area and circumference of a circle

Write a MATLAB program that will allow the user to find area and circumference of a circle. Selections and data entry will be done by presenting the user with a menu (using menu function) and provide her/him with the following choices:  ? Enter the ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd