
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
write a c program to -
(a)(i) Create an City structure that will have the following members: name (string type), population (int type), area (float type) and numOfCOVIDPatients (int type).
(ii) In the main function, create an array of size N of City structure type. This array will be used by all the functions. You will have a lower case n to keep track of the number of cities in the array. You will pass this array and # of cities  as arguments to the functions.
(b) Create a function “takeCitiesInfoFromKeyboard” that takes a City structure array and n as parameters. It takes information of all the Cities from keyboard and stores in the City structure array. Do you know that arrays are passed by reference?
(c) Create a function “searchACity” that takes a City structure array, # of COVID patients, and n as parameters. It finds and displays the city’s information from the array searching by the # of COVID patients.
(d) Create a function “displayAllCitiesInfoReverse” that takes a City structure array and the size of the array as parameters. It displays all Cities’ information in reverse index order in a tabular format with following values (including the given column heading):
City Name – City Population – City Area – Num of City COVID Patients
======= BD Covid Case Tracking System =========
• Enter ‘r, to take information of all the cities into the City structure array of size N.
• Enter ‘s’, to search a City by # of COVID patients. If found, display the info of City. If not, display “Not Found”.
• Enter ‘t’, to display the information of all the Cities in reverse index order in a tabular format.
• Enter ‘q’, quit/exit the menu system.
• For any other input, display “Invalid Input”
After the menu is displayed, the program will prompt the user “Enter your choice: “ to enter a choice from the menu. After user enters his choice, using switch case the program will call appropriate functions to do the task.
(a)(i) Create an City structure that will have the following members: name (string type), population (int type), area (float type) and numOfCOVIDPatients (int type).
(ii) In the main function, create an array of size N of City structure type. This array will be used by all the functions. You will have a lower case n to keep track of the number of cities in the array. You will pass this array and # of cities  as arguments to the functions.
(b) Create a function “takeCitiesInfoFromKeyboard” that takes a City structure array and n as parameters. It takes information of all the Cities from keyboard and stores in the City structure array. Do you know that arrays are passed by reference?
(c) Create a function “searchACity” that takes a City structure array, # of COVID patients, and n as parameters. It finds and displays the city’s information from the array searching by the # of COVID patients.
(d) Create a function “displayAllCitiesInfoReverse” that takes a City structure array and the size of the array as parameters. It displays all Cities’ information in reverse index order in a tabular format with following values (including the given column heading):
City Name – City Population – City Area – Num of City COVID Patients
======= BD Covid Case Tracking System =========
• Enter ‘r, to take information of all the cities into the City structure array of size N.
• Enter ‘s’, to search a City by # of COVID patients. If found, display the info of City. If not, display “Not Found”.
• Enter ‘t’, to display the information of all the Cities in reverse index order in a tabular format.
• Enter ‘q’, quit/exit the menu system.
• For any other input, display “Invalid Input”
After the menu is displayed, the program will prompt the user “Enter your choice: “ to enter a choice from the menu. After user enters his choice, using switch case the program will call appropriate functions to do the task.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a function in C++ language which takes two parameters as arguments, the first being an integer array and the second being the size of this integer array, and sorts this integer array in descending order. Write a similar function which takes the same arguments, but sorts the integer array in ascending order. Write a C++ program which takes integer values from user, inserts them into an integer array, uses these two functions to sort the array in ascending and descending order and prints the results on screen. You can take any size of the integer arrayarrow_forwardWrite a program in C write a two-dimension array in the main function that contains different names and grades, then write a function that will ask the user if he wants : Press 1 for print passing students names and grades Press 0 for print failing students names and grades Press 2 for printing all the student's names and grades after that, the function will print what the user wants hint : >= 60 passedarrow_forwardCreate a function using Java: Number of Rows = 3-6 Number of Columns = 3-6 Function Name: winInDiagonalFSParameters: board: 2D integer array, piece: integerReturn: booleanAssume board is valid 2D int array, piece is X==1/O==2.Look at all forward slash / diagonals in the board. If any forward slash / diagonals has at least 3consecutive entries with given type of piece (X/O) (3 in a row XXX, OOO), then return true,otherwise falsearrow_forward
- WRITE A PROGRAM IN C++ You work for an loan analytics organization have been tasked with writing a program that simulates an analysis of loan applications. Code a modular program that uses parallel arrays to store loan application credit scores (values generated between 300 and 900), score ratings (poor, fair, good, very good, or exceptional based on credit score) and loan status (approved or declined applications based on credit score). The program must do the following: The program must first ask the user for the number of loan applications that will be in the simulation. This must be done by calling the getNumLoanApplications() function (definition below). After the input of the number of accounts, the program must use loops and random numbers to generate the credit score, score rating, and application result for each loan application in parallel arrays. These arrays must not be declared globally (major error). The following arrays must be declared and populated: creditScores[]…arrow_forward1. Write a program that defines a struct named Info. That Info struct should define two strings, a double and array of strings. In your main program, define a variable v using that Info struct and then initialize it to hold your first name, your last name, your lucky non-whole number (e.g. 26.5), your major, and a listing (an array) of your six most favorite college courses you have ever taken or plan to take. Then your program should access and print all the stored data held in the variable v. 2. print the data twice, once using the structure variable and do-while loop, and next using a pointer variable and a while-do loop.) Using the embed icon shown above show screenshots demoing the execution of your program.arrow_forwardWrite in C++ 1. Define a struct for a soccer player that stores their name, jersey number, and total points scored. 2.Using the struct in #1, write a function that takes an array of soccer players and its size as arguments and returns the average number of points scored by the players. 3.Using the struct in #1, write a function that takes an array of soccer players and its size as arguments and returns the index of the player who scored the most points. 4.Using the struct in #1, write a function that sorts an array of soccer players by name. 5.Using the struct in #1, write a function that takes an (unsorted) array of soccer players and its size and a number as arguments, and returns the name of the soccer player with that number. It should not do any extra unnecessary work. 6.Define a function to find a given target value in an array, but use pointer notation rather than array notation whenever possible. 7.Write a swap function, that swaps the values of two variables in main, but use…arrow_forward
- C++ pleasearrow_forward1. Define a struct for a soccer player that stores their name, jersey number, and total points scored. 2. Using the struct in #1, write a function that takes an array of soccer players and its size as arguments and returns the average number of points scored by the players.3. Using the struct in #1, write a function that takes an array of soccer players and its size as arguments and returns the index of the player who scored the most points.4. Write a Circle class that has the following member variables:• radius : a double• pi : a double initialized with the value 3.14159The class should have the following member functions:• Default Constructor. A default constructor that sets radius to 0.0.• Constructor. Accepts the radius of the circle as an argument.• setRadius. A mutator function for the radius variable.• getRadius. An accessor function for the radius variable.• getArea. Returns the area of the circle, which is calculated as area = pi * radius * radius• getCircumference. Returns…arrow_forwardwrite in html and scriptarrow_forward
- Construct an optimal binary search tree for five keys A, B, C, D, E with probabilities p1 = 0.1, p2 = 0.3, p3 = 0.1, p4 = 0.4, p5 = 0.1. Show(1) the main table; (2) the root table; (3) all computations to fill in the main table and the root table; (4) the optimal binary search tree based on the root table; (5) that the average number of comparisons of your optimal binary search tree is indeed C(1,5).arrow_forwardProgram in C. You are grading your students’ exams and will create a program to help you with the process. Each exam contains 3 problems. Minimum score in each problem is 0; maximum score is 33.33. Use these steps as your guidance: Define a structure called Student. Give the structure 4 members; one ID (integer) and three scores (decimal numbers). Then, in main, ask for the number of students you will be grading. Then, create an array of structures of type Student. Then, also in main, iterate through each one of them and scan their ID and scores. Lastly, also in main, print out the ID of the student, followed by the final grade (addition of the three scores). Notes: You don’t have to check if the user inputted a score between 0 and 33.33. You may assume users will always input a score within this range. No need of functions (everything can be done in main if you want to).arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education