Practice Final Professor Conroy CSC111 Fall 2021 Practice Final Exam (97pts) Write a function namedgrowthat takes astruct Fishas a parameter and adds 5 to its length attribute and 1 to its weight...

1 answer below »

Practice Final Professor Conroy CSC111 Fall 2021 Practice Final Exam (97pts)


Write a function namedgrowthat takes astruct Fishas a parameter and adds 5 to its length attribute and 1 to its weight attribute. The function should not return a value, but the program that called the function should still see the changes made to the fish variable’s properties after the function finishes execution. (5pts)


Design astruct WaterBalloonwith propertiesstring coloranddouble radius.Outside thestructdefinition, in main(), create three WaterBalloon variables. Make one color property red, one color property green, and one color property blue. The radius of the red baloon should be 3.14. The radius of the green baloon should be 42.2, and the radius of the blue baloon should be 1. Print the sum of the radii of all of the balloons to the screen. (6pts)


In a program where a variable is declared:int x = 33In what physical component of the computer is the value 33 stored. Using C++ code, how would you find the address of this value in that place. (2pts)


pg 1 of 7


Practice Final Professor Conroy CSC111 Fall 2021 Practice Final Exam (97pts)


An instructor tells you to add the numbers from 1 to 10 together. You start with the first and second value and add them together to get 3. You then take this result (3) and add it to the third number (also 3) to get 6. You continue doing this process up to and including the number 10. You get the answer 55. Was your performance of this calculation the execution of an algorithm, why or why not? (4pts)


Write a function that takes a two dimensional array of integers as a parameter and returns avector vcontaining the smallest integer from each row of the array. (10pts)


Write amainprogram that asks a user their name and then continuously asks the user for words until the user types quit. The program should calculate the average of the word lengths and display that average length on screen. The program should then wish them goodbye, mentioning them by name and exit. (8pts)


pg 2 of 7


Practice Final Professor Conroy CSC111 Fall 2021 Practice Final Exam (97pts)


Write a program that reads a series of words (one word per line) from a file nameddata.txt. Each word in the file should have each of its characters shifted by 1 character value in the ASCII table (incremented) and then that new word with its characters shifted should be printed to a new file namedresult.txt. Each word fromdata.txtshould be reprinted with its new encoding inresult.txt. Your program should not have any knowledge of how many words are indata.txtor how long the words are or what those words might be. In other words, your program should work for any file composed of a list of words with one per line. (8pts)


Write a function that takes an integer as a parameter and returns a new array of strings that is the size of the value of the parameter passed into the function. Please dynamically allocate the memory for the new array and return the dynamically allocated memory with the appropriate return type for this type of memory. (4pts)


Write amain()function that takes 3stringsas input from the user and stores those values in 3 variables. Print those values to the screen in alphabetical order. (7pts)


pg 3 of 7


Practice Final Professor Conroy CSC111 Fall 2021 Practice Final Exam (97pts)


Write a program that creates two variables, one of typeintnamed,the_answer, and the other a pointer to an int named reference. Set theintvariable named the_answer, to 42 and then set the pointer variable to the address ofthe_answer. Increment the value ofthe_answerby using only the pointer variable namedreference. (4pts)


What is the difference between the linear search and binary search? When would you use either? Which is most efficient (5pts)


What lines in your program invoke the preprocessor? What does the preprocessor do to your code at these lines? (2pts)


pg 4 of 7


Practice Final CSC111 Fall 2021


Professor Conroy Practice Final Exam (97pts)


Design a class Room (32pts)


Theclassshould have private member variableslength,width, andheight, all of typedouble, and a private member variable,name, of typestring.


It should have public methods:


getVolume– should return the volume of the room by multiplying length, width and height together and returning the result


getSquareFeet– should return the area of the room by multiplying the length and width together and returning the result


getLength– should return the length of the room


getWidth– should return the width of the room


getHeight– should return the height of the room


setLength– should set the private variable length to the parameter passed into the function, the function should not return a value


setWidth- should set the private variable width to the parameter passed into the function, the function should not return a value


setHeight- should set the private variable height to the parameter passed into the function, the function should not return a value


setName– should set the private variable name to the parameter passed into the function, the function should not return a value


You should have a constructor and a destructor for this class. The constructor takes a string parameter and sets that parameter to the private member variable name. Each room’s length, width, and height should be given a default value of 10 X 15 X 9 (10 for length, 15 for width, and 9 for height). The constructor should also print the message, “creating a room” to standard output. The destructor simply prints the message “destroying a room”


Inmain(), you should make an array named house that holds 10 rooms. The names of each room should be: living room, kitchen, dining room, basement, bathroom, bedroom1, bedroom2, bedroom3, office, sunroom. You should alter the basement by setting its length to 30 and its width to 50. Write a loop in main that prints the name of each room followed by its length, width, and height. Also print out the total volume of all the rooms in the house.

Answered Same DayDec 14, 2021

Answer To: Practice Final Professor Conroy CSC111 Fall 2021 Practice Final Exam (97pts) Write a function...

Vaibhav answered on Dec 14 2021
124 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here