Question
1. Create a file named geometry.h that will contain the following functions: VolSphere() AreaSphere() VolCone() AreaCone() VolCylinder() AreaCylinder() VolDonut() Hint: Donut/Torus volume = 2 *
1. Create a file named geometry.h that will contain the following functions:
VolSphere() AreaSphere() VolCone() AreaCone() VolCylinder() AreaCylinder() VolDonut()
Hint: Donut/Torus volume = 2 * pi * pi * R * r * r
Food items will have these dimension: Apple - sphere that is 3" diameter Pizza - cylinder that is 12" diameter and 0.5" thick Donut - 4" diameter and 2" hole (R=1.5, r=0.5) Ice Cream Cone - cone is 5" tall with a 2" diameter; it has one scoop of ice cream that's a 2.5" diameter sphere Create a program named food.cpp that asks the user how many apples, pizzas, donuts, and ice cream cones they will eat. Tell the user the total volume of food they will eat.
Please turn in both the geometry.h file and food.cpp, along with the output.
2.
2. Write a program called lol.cpp that allows the user to enter a sentence. Then program then searches the sentence for various lolspeak abbreviations and substitutes them with the proper words. You should have a function named LOLSpeak that takes your sentence as a parameter and returns the corrected sentence. Make your program work with the three abbreviations below AND at least 7 more of your own (total 10). You may assume that there is a space before and after your abbreviation.
Search for this | Replace it with this |
" u " | " you " |
" lol " | " laughing out loud " |
" brb " | " be right back " |
Note: You cannot use a normal cin statement to input a sentence (it truncates after the first space).
char Input[80]; cout << "Enter a sentence: "; cin.getline(Input, 80, ' '); string Sentence = Input;
Program 2 Example Output
This program will correct ur lolspeak abrreviations. Enter a sentence: I think that u are lol at my joke. The corrected sentence: I think that you are laughing out loud at my joke.
Extra Credit #1: Check if the abbreviation is at the beginning or end of a sentence. Extra Credit #2: Have your abbreviations and replacements in a file that is read in and processed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started