Write a count controlled loop to read in two columns of 30 numbers each Calculate the avg of each column.

computer science

Description

Exam 2 class review

 

1)     Write a count controlled loop to read in two columns of 30 numbers each Calculate the avg of each column.

 

 

2)     Write for loop(s)  to calculate and  output x2+3xy+y1/2 for all values of x from 1 to 10 and y from 1 to 5

 

 

3) Read in (numbers are representative, comma delimited)

1.124cm,22.25m

 

 

4)Read in a number, string, number from a data file.  The field width is 15

 

 

5) Write a for loop to read in 100 data points and  calculate the minimum

 

 

 

6) Write a selection structure to assign a department name given a department number.   <1000 Hardware, 1000-1999 Books,  2000-2999 Toys, >3000 Misc

 

 

7) Write a switch statement that converts number on a phone to a letter

 

8) Write a do while loop that reads in three columns of data a negative in the first column means stop (sentinel) second column (a) and third column (b). Calculate the number of a’s less than 500 and the number of b’s greater than 500

 

9) Write a while loop to read in two columns of words (field width 10) print out the words where the two columns match.

 

10) Write a loop to output  a comma delimited file  with the following columns

Id’s (10001-10025)

Grade (Random int 0-100)

Average (Random float 0-100)

 

11) Write a selection structure to print error based on error number

            101: Invalid input

            102: Can’t connect to device

            103: File not Found

            104: Other


 

 

Methods

1)      Do #11 with  method

2)     Write a method to return the maximum of three numbers

 

 

 

Practice Lab Quiz

 

Ask user for salesman id (1-10)

Read in file StateSales.txt

Output data for selected saleman and total sales for that salesman (salesman#7 shown below)

 


Related Questions in computer science category