Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programing question: Write a program that uses a two-dimensional array to store the date and the weight. The program should output the highest, the

C++ Programing question:

Write a program that uses a two-dimensional array to store the date and the weight. The program should output the highest, the lowest, the average, occurrence of highest and occurrence of the lowest weight in the file. Your program must consist of the following functions:

First function is to read the data from a file and store the data in the two-dimensional array. The file consists of 60 elements.

The second function calculates and return the date and the highest weight in the array. Display the result in main

The third function calculates and return the date and the lowest weight in the array. Display the result in main

The fourth function calculates and return the average of the weights in the array. Display the result in main

The fifth function calculates and displays the occurrence of the lowest and highest weight in the array

You are not allowed to use global arrays or variables, vector arrays , linked list. You are only allowed to use 2 dimensional arrays.

Note: The name of the file is weight.txt and contains the following data

6 1 2021 192.2 6 2 2021 191.1 6 3 2021 192.5 6 4 2021 192.5 6 5 2021 191.8 6 6 2021 190.0 6 7 2021 193.5 6 8 2021 192.5 6 9 2021 191.6 6 10 2021 188.4 6 11 2021 188.1 6 12 2021 193.5 6 13 2021 190.4 6 14 2021 188.4 6 15 2021 188.8 6 16 2021 189.4 6 17 2021 187.4 6 18 2021 188.3 6 19 2021 187.1 6 20 2021 189.4 6 21 2021 193.2 6 22 2021 191.1 6 23 2021 189.1 6 24 2021 190.3 6 25 2021 192.3 6 26 2021 190.3 6 27 2021 190.7 6 28 2021 191.4 6 29 2021 191.4 6 30 2021 190.5 7 1 2021 190.7 7 2 2021 190.5 7 3 2021 190.8 7 4 2021 191.4 7 5 2021 190.5 7 6 2021 192.7 7 7 2021 191.6 7 8 2021 189.1 7 9 2021 189.8 7 10 2021 190.9 7 11 2021 189.8 7 12 2021 190.9 7 13 2021 190.3 7 14 2021 189.7 7 15 2021 190.9 7 16 2021 190.5 7 17 2021 187.1 7 18 2021 190.5 7 19 2021 192.5 7 20 2021 191.5 7 21 2021 192.5 7 22 2021 189.6 7 23 2021 190.5 7 24 2021 192.5 7 25 2021 191.6 7 26 2021 191.5 7 27 2021 193.5 7 28 2021 190.5 7 29 2021 191.6 7 30 2021 192.3

Output of program should look like:

image text in transcribed

Welcome to Weight Analysis Program. The program should output the highest, the lowest, the average, occurrence of highest and occurrence of the lowest weight in the file. 193.5 The Highest Weight in the Array: Date : 7-27-2021 187.1 The Lowest Weight in the Array: Date : 7 - 17 - 2021 The Average of the Weights in June and July : 190.8 The occurrence of the lowest and highest weight in the array are as follows: The Lowest: 6 - 19-2021 7 - 17 - 2021 The Highest: 6-7-2021 6 - 12 - 2021 7-27-2021 Number of occurrence of min weight: 2 Number of occurrence of max weight: 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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions