Assignment 1• Write a program that asks the user to enter the size of two sides of arectangle and store them in doubles length and width variables.• Check if the values entered are all greater than...

Assignment 1• Write a program that asks the user to enter the size of two sides of arectangle and store them in doubles length and width variables.• Check if the values entered are all greater than zero. If not, display themessage “The sides of a rectangle must be positive”. Use the if/else ifstatement to validate the user inputs. Use the last else statement to handlethe case user enter something else.• The user can request one of two of operations: the area (‘A’ or ‘a’) of therectangle or the perimeter (‘P’ or ‘p’) of the rectangle. If the user entersthe char ‘A’ or ‘a’ for the area of rectangle, the program calculates anddisplays the area of given rectangle. If the user enters ‘P’ or ‘p’ for theperimeter of the rectangle, the program calculates and display theperimeter of the rectangle. Use the switch statement to check the userrequest and display the response. Use the default case in switch statementto handle the case if the user enter characters than ‘A’ or ‘P’.
Assignment 2 – Rectification on the next page• 2D Array Operation• Write a program that creates a two-dimensional array of integers initialized with zeros. The program should have the functions:• getTotal - This function should accept a two-dimensional array as its argument and return the total of all the values in the array.• getAverage - This functions should accept a two-dimensional array as its argument and return the average of all the values in the array.• getRowTotal - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The second argumentshould be the subscript of a row in the array. The function should return the total of the values in the specified row.• getColumnTotal - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The second argumentshould be the subscript of a column in the array. The function should return the total of the values in the specified column.• getHighestInRow - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The second argumentshould be the subscript of a row in the array. The function should return the highest value in the specified row of the array.• getLowestInRow - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The second argumentshould be the subscript of a row in the array. The function should return the lowest value in the specified row of the array.• The program should prompt the user to enter two integers, one for the size of row and the other for the size of column of the two-dimensional array.• The program askes the user to enter the integers and fills up the two-dimensional array.• With the array filled, the program prompt the user to choose a function to perform among the following:T or t - to display the total of all the values in the array returned by getTotal function.A or a - to display the average of all the values in the array returned by getAverage function.R or r - to dispaly the total of the values in the specified row returned by getRowTotal function.C or c - to display the total of the values in the specified column returned by getColumnTotal function.H or h - to display the the highest value in the specified row of the array returned by getHighestInRow function.L or l - to display the the lowest value in the specified row of the array returned by getLowestInRow function.E or e - to Exit the program.Assignment 2 - 2D Array Operation - Rectified• Write a program that creates a two-dimensional array of integers initialized with zeros. The program should have the functions:• getTotal - This function should accept a two-dimensional array as its argument and return the total of all the values in the array.• getAverage - This functions should accept a two-dimensional array as its argument and return the average of all the values in the array.• getRowTotal - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The secondargument should be the subscript of a row in the array. The function should return the total of the values in the specified row.• getColumnTotal - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The secondargument should be the subscript of a column in the array. The function should return the total of the values in the specified column.• getHighestInRow - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The secondargument should be the subscript of a row in the array. The function should return the highest value in the specified row of the array.• getLowestInRow - This function should accept the two-dimensional array as its first argument and an integer as its second argument. The secondargument should be the subscript of a row in the array. The function should return the lowest value in the specified row of the array.• The program askes the user to enter the integers and fills up the two-dimensional array. The number maximum of the integer the array shouldstore is 100.• With the array filled, the program prompt the user to choose a function to perform among the following:T or t - to display the total of all the values in the array returned by getTotal function.A or a - to display the average of all the values in the array returned by getAverage function.R or r - to dispaly the total of the values in the specified row returned by getRowTotal function.C or c - to display the total of the values in the specified column returned by getColumnTotal function.H or h - to display the the highest value in the specified row of the array returned by getHighestInRow function.L or l - to display the the lowest value in the specified row of the array returned by getLowestInRow function.E or e - to Exit the program
Jun 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here