Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COSC-1436, Lab Assignment 6 Submit your answers to the following questions in a word processing document that is compatible with Microsoft Word. The name of

COSC-1436, Lab Assignment 6

Submit your answers to the following questions in a word processing document that is compatible with Microsoft Word. The name of the file you submit should be XYLab6, where X and Y are your first and last initials.

Questions (50 points):

1. Given an integer array named values that contains 25 elements. Write both a regular for loop, as well as a range-based for loop where each loop displays each of the elements in the array.

2. Given two arrays named numberArray1 and numberArray2 that each have 80 elements, write the code that will copy all the values in numberArray1 to numberArray2.

3. As part of a larger program, you need to write code that will store and display the names and population values for 14 countries. Compose the code necessary to define two arrays that will be used in parallel to store the country names and their populations. Assume that a different part of the larger program is responsible for loading values into the parallel arrays you created. Write code that will display each of the countrys names and their corresponding population values.

4. Is there anything seriously wrong with the following code? If so, explain and provide a remedy.

int SIZE = 25;

double values[SIZE];

for (int i = 1; i < SIZE; i++)

{

values[i] = 0.0;

}

5. Compose a function that accepts an array of integer values as an argument and returns the total of the values in the array.

Programming Exercise (50 points):

Write a C++ console application that allows your user to enter the total rainfall for each of 12 months into an array of doubles. The program should validate user input by guarding against rainfall values that are less than zero. After all 12 entries have been made, the program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest rainfall amounts.

Submit two files. A word processing file with your answers to the five Questions and a compressed file containing your solution to the Programming Exercise. Remember to submit them both at the same time.

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

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago

Question

5. List the forces that shape a groups decisions

Answered: 1 week ago

Question

4. Identify how culture affects appropriate leadership behavior

Answered: 1 week ago