Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project #0 Review of C P ROBLEM S TATEMENT : Write a program that reads in a user-specified number of integers from the keyboard, stores

Project #0 Review of C PROBLEM STATEMENT: Write a program that reads in a user-specified number of integers from the keyboard, stores the integer values in an array, and outputs each element of the array to the screen along with an appropriate string literal. The program should be named testIntegerValues.c. Your program should do the following: 1. Read, from the keyboard, the number of integers that should be input.
  • The number of integers specified should not exceed MAX_SIZE, where MAX_SIZE is the maximum size of the array.
  • If the number of integers specified exceeds MAX_SIZE
? Print the warning The number specified exceeds the maximum allowable value. ? Then prompt the user to enter another value. ? Repeat until the user enters a valid value.
  • ** Declare a constant named MAX_SIZE with a value of 50. **
2. Read the integers from the keyboard and store in the array.
  • Prompt the user to enter a single integer value.
  • Read the integer value from the keyboard and store it in the array.
  • Repeat until all values are read in from the keyboard.
  • ** Declare an array of size MAX_SIZE. **
3. Output each integer value (in the array) along with an appropriate string literal.
  • Print one integer value, along with an appropriate string literal, on each line.
  • The string literal that should be printed is determined as follows: ? if the value is divisible by 3, print divisible by 3 ? if the value is divisible by 4, print divisible by 4 ? if the value is divisible by both 3 and 4, print divisible by 3 and 4
? otherwise, print none
  • The integer value and the string literal should be separated by a tab.
Test your program! We will test your program using our own test bench (i.e. our own input values). Your program will be graded based on the results of our tests. GRADING RUBRIC: 20 pts. Reads in a valid value for the number of integers to be input. Prompts the user to enter a valid value if the value specified exceeds the maximum size of the array. Repeats until a valid value is entered. 20 pts. Reads the integer values and stores them in the array. 15 pts. Outputs divisible by 3 when the integer value is divisible by 3. 15 pts. Outputs divisible by 4 when the integer value is divisible by 4. 20 pts. Outputs divisible by 3 and by 4 when the integer value is divisible by both 3 and by 4. 10 pts. Outputs none when none of the above conditions are true. EXAMPLE: Enter the number of integer values to be read in: 75 The value specified exceeds the maximum size of the array. Please enter another number: 7 Enter an integer value: 1 Enter an integer value: 4 Enter an integer value: 7 Enter an integer value: 9 Enter an integer value: 12 Enter an integer value: 26 Enter an integer valeu: 32 The values stored in the array are: 1 none 4 divisible by 4 7 none 9 divisible by 3 12 divisible by 3 and by 4 26 none 32 divisible by 4 Done.

Attachments:

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

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Solve the equation in the complex number system. x-16x+89=0

Answered: 1 week ago