Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CST 3 7 0 Spring 2 0 2 4 Homework 1 Due: 0 2 / 1 1 / 2 0 2 4 ( Sunday )

CST 370 Spring 2024Homework 1Due: 02/11/2024(Sunday)(11:55 PM) How to turn in: Develop two programs in either C++ or Java on your local system and then push your final submission to your private repository. You can submit your programs multiple times before the due date. However, the last submission will be used for grading. Due time is 11:55(PM). Since there could be a long delay between your computer and GitHub Classroom, you should submit it early. When you submit your homework program, dont forget to include "Title", "Abstract", "Name", and "Date". 1. Write a C++ program (or Java program) that reads two groups of numbers in which each group has several integer numbers with potential duplicates. Your program should display the non-intersecting numbers in the two groups in descending order. Input format: This is a sample input from a user.57208-71538147 The first number (=5 in the example) indicates that there are five numbers in the first group. Then, the numbers from the second line (=7 in the example) to the sixth line (15 in the example) are actual numbers of the first group.The following number (=3 in the example) indicates that there are three numbers in the second group which are 8,14, and 7. For the program, you can assume that there will be less than 200 input integer numbers in each group. For the input, your program should present the non-intersecting numbers in both groups in the descending order. Note that both 7 and 8 are common numbers in the two groups. Thus, you have to display the non-intersecting numbers (=20,15,14,-7) in the descending order on the screen. If theres no non-intersecting number, your program should display NONE. Sample Run 0: Assume that the user typed the following lines. 57208-71538147 This is the correct output of your program. Answer:201514-7 Sample Run 1: Assume that the user typed the following lines. 45-5503-505 This is the correct output of your program. Answer:NONE Sample Run 2: Assume that the user typed the following lines. 733-574274274-5 This is the correct output of your program. Answer:32. Write a C++ program (or Java program) for hw1_2 that reads input numbers from a user and displays the number(s) in the order of frequencies. Input format: This is a sample input from a user.6-7-72012-712 The first number (=6 in the example) indicates that there are six integer numbers in the input. Then, all numbers from the second line (=-7 in the example) to the last line (12 in the example) are actual input numbers. Note that the frequency of -7 is 3 and the frequency of 12 is 2. Also, the frequency of 20 is just 1. Thus, your program should display them in the order of frequencies (= ascending order) such as 201212-7-7-7. For the numbers with the same frequency, you have to display them in the ascending order. For the program, you can assume that there will be less than 200 input integer numbers. Sample Run 0: Assume that the user typed the following lines. 6-7-72012-712 This is the correct output of your program. 201212-7-7-7 Sample Run 1: Assume that the user typed the following lines. 102020-155722052055 This is the correct output of your program. Note that the frequencies of -15 and 72 are 1. Thus, you have to display -15 first and then 72. Similarly, since the frequencies of 5 and 20 are 4, you should display all 5s first. After that, display all 20s.-1572555520202020 Sample Run 2: Assume that the user typed the following lines. 3555 This is the correct output of your program. 555 Sample Run 3: Assume that the user typed the following lines. 12555525454545451555555525 This is the correct output of your program. 152525454545455555555555

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

Question

What physical locations do you work in?

Answered: 1 week ago