Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ 2. Write a C++ program (or Java program) called hw4_2.cpp (or hw4_2.java) that reads a set of events and displays the maximum number

In C++

image text in transcribed

image text in transcribed

2. Write a C++ program (or Java program) called hw4_2.cpp (or hw4_2.java) that reads a set of events and displays the maximum number of events that take place concurrently. Input format: This is a sample input from a user. 5 7 12 10 14 8 11 12 15 16 20 The first number (= 5 in the example) indicates that there will be five events in a convention center. All numbers from the second line to the last line are event hours. For example, the first event starts at 7:00(AM) and ends at noon (= 12:00(PM)). The second event starts at 10:00(AM) and ends at 2:00(PM). The last event starts at 4:00(PM) and ends at 8:00(PM). Sample Run 0: Assume that the user typed the following lines 5 7 12 10 14 8 11 12 15 16 20 This is the correct output of your program. Max events: 3 2. Write a CH program (or Java program) called hw4_2.cpp (or hw4_2.java) that reads a set of events and displays the maximum number of events that take place concurrently. Input format: This is a sample input from a user. 5 7 12 10 14 8 11 12 15 16 20 The first number ( 5 in the example) indicates that there will be five events in a convention center. All numbers from the second line to the last line are event hours. For example, the first event starts at 7:00(AM) and ends at noon (= 12:00(PM)). The second event starts at 10:00(AM) and ends at 2:00(PM). The last event starts at 4:00(PM) and ends at 8:00(PM). Sample Run 0: Assume that the user typed the following lines 5 7 12 10 14 8 11 12 15 16 20 This is the correct output of your program. Max events: 3 Note that there will be three events from 10:00(AM) to 11:00(AM). Also, there will be three events at 12:00(PM). So, the maximum number of events that take place concurrently should be 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions