IN C++
You are to write a program which will get the following variables from the user.
Length, Width, Height, Radius, Base.
You should also have variables for Pi as 3.14 and choice1 and choice2.
Your program will first ask the following:
Press 1 to calculate Area
Press 2 to calculate Perimeter
The choice will be saved in choice1.
You should then ask another choice:
Press 1 for Rectangle
Press 2 for Triangle
Press 3 for Circle
You have all the data required to calculate these except the Perimeter of the triangle. Only in this case will you ask the user to input lengths of side1, side2 and side3.
**You can do the shapes first and then the area/perimeter if you prefer**
Display the data neatly to the user.
Answer:
The program is as follows:
#include <iostream>
using namespace std;
int main(){
double pi = 3.14;
int choice1, choice2;
double Length, Width, Height, Radius, Base;
double side1, side2, side3;
cout<<"Length: "; cin>>Length;
cout<<"Width: "; cin>>Width;
cout<<"Height: "; cin>>Height;
cout<<"Radius: "; cin>>Radius;
cout<<"Base: "; cin>>Base;
cout<<"Press 1 to calculate Area\nPress 2 to calculate Perimeter\n";
cin>>choice1;
if(choice1 == 1){
cout<<"Press 1 for Rectangle\nPress 2 for Triangle\nPress 3 for Circle\n";
cin>>choice2;
if(choice2 == 1){ cout<<"Area: "<<Length * Width; }
else if(choice2 == 2){ cout<<"Area: "<<0.5 * Base * Height; }
else if(choice2 == 3){ cout<<"Area: "<<pi * Radius * Radius; }
else{cout<<"Invalid choice";} }
else if(choice1 == 2){
cout<<"Press 1 for Rectangle\nPress 2 for Triangle\nPress 3 for Circle\n";
cin>>choice2;
if(choice2 == 1){ cout<<"Perimeter: "<<2 * (Length + Width); }
else if(choice2 == 2){
cout<<"Side 1: "; cin>>side1;
cout<<"Side 2: "; cin>>side2;
cout<<"Side 3: "; cin>>side3;
cout<<"Perimeter: "<<side1+side2+side3; }
else if(choice2 == 3){ cout<<"Perimeter: "<<2 * pi * Radius; }
else{cout<<"Invalid choice";} }
return 0;}
Explanation:
This initializes pi as 3.14
double pi = 3.14;
The next three lines declare all variables
int choice1, choice2;
double Length, Width, Height, Radius, Base;
double side1, side2, side3;
The next 5 lines get inputs
cout<<"Length: "; cin>>Length;
cout<<"Width: "; cin>>Width;
cout<<"Height: "; cin>>Height;
cout<<"Radius: "; cin>>Radius;
cout<<"Base: "; cin>>Base;
This prompts the user for choice 1 (area or perimeter)
cout<<"Press 1 to calculate Area\nPress 2 to calculate Perimeter\n";
This gets input for choice 1
cin>>choice1;
If choice 1 is 1, then area is calculated
if(choice1 == 1){
This prompts the user for choice 2 (rectangle, triangle or circle)
cout<<"Press 1 for Rectangle\nPress 2 for Triangle\nPress 3 for Circle\n";
This gets input for choice 2
cin>>choice2;
Calculate area of rectangle if rectangle is selected
if(choice2 == 1){ cout<<"Area: "<<Length * Width; }
Calculate area of triangle if triangle is selected
else if(choice2 == 2){ cout<<"Area: "<<0.5 * Base * Height; }
Calculate area of circle if circle is selected
else if(choice2 == 3){ cout<<"Area: "<<pi * Radius * Radius; }
Print invalid choice for all other inputs
else{cout<<"Invalid choice";} }
If choice 1 is 2, then perimeter is calculated
else if(choice1 == 2){
This prompts the user for choice 2 (rectangle, triangle or circle)
cout<<"Press 1 for Rectangle\nPress 2 for Triangle\nPress 3 for Circle\n";
This gets input for choice 2
cin>>choice2;
Calculate perimeter of rectangle if rectangle is selected
if(choice2 == 1){ cout<<"Perimeter: "<<2 * (Length + Width); }
Calculate perimeter of triangle if triangle is selected
else if(choice2 == 2){
Get input for the three sides of the triangle
cout<<"Side 1: "; cin>>side1;
cout<<"Side 2: "; cin>>side2;
cout<<"Side 3: "; cin>>side3;
cout<<"Perimeter: "<<side1+side2+side3; }
Calculate perimeter of circle if circle is selected
else if(choice2 == 3){ cout<<"Perimeter: "<<2 * pi * Radius; }
Print invalid choice for all other inputs
else{cout<<"Invalid choice";} }
return 0;
Python (and most programming languages) start counting with 0.
True
False
Answer:
yes its true :)
Explanation:
Which wireless probe is designed to scan and record wireless signals within its range at regular intervals and report the information to a centralized database
Wireless probe are often referred to as a device that is said to monitor the airwaves for RF traffic. A standard wireless device is designed to scan and record wireless signals within its range at regular intervals and report the information to a centralized database
Wireless device probe consist of a standard wireless device, such as a portable laptop computer which at regular intervals, during the normal course of operation, can scan and record wireless signals.Desktop probe are also known as a standard desktop PC that often uses a universal serial bus (USB) wireless network interface card adapter to monitor the RF frequency.
Dedicated probe are made to monitor the RF frequency for transmissions.
Learn more from
https://brainly.com/question/14329343
Which of the following represents an input on a smartphone?
A pressing the volume key
B an appointment displayed by your calendar
C your phone ringing
D your screensaver turning on
Answer:
Pressing the volume key.
Explanation:
The appointment is and output. It is being shown to you from the smartphone.
The volume key is an input. Your telling the smartphone to raise its volume.
The phone ringing is also an output, and so is the screensaver turning on.
Answer:
A. Pressing the Volume Key
Hope this helped (~0>0)~Which device is not considered a computer?
a smartphone
an analog controller
Answer:
An analog controller is not considered a computer because you just move around the controls. You don't stare at a screen like a smartphone, so it is not a computer.
Explanation:
The the concept of plug-and-play is demonstrated by which of the following scenarios
Answer:
What are the Scenarios
I will update this when you give us them
Explanation:
Answer: Farrah has completed a post-secondary education program and is now ready to begin working, without additional training, on her first day.
Explanation:
Complete the sentence.
If you wanted the best performance for a game that requires a powerful graphics processor and lots of memory, you
would run it on a
tablet
desktop
smartphone
Message queues allow for programs to synchronize their operations as well as transfer data. How much data can be sent in a single message using this mechanism
The maximum size of a message queue is 16384 bytes for Linux. For IBM WebSphere MQ. this value is 4 MB.
What is the message queue?The size of the message queue refers to the size (in bytes) that a message may have for a given operative system.
For example, the maximum value for IBM WebSphere MQ has been configured in four megabytes (4 MB).
In this case, when the message is higher than the set size (here 4 MB), then this message is returned.
Learn more about IBM here:
https://brainly.com/question/896257
How did the case Cubby v. CompuServe affect hosted digital content and the contracts that surround it?
Although CompuServe did post libellous content on its forums, the court determined that CompuServe was just a distributor of the content and not its publisher. As a distributor, CompuServe could only be held accountable for defamation if it had actual knowledge of the content's offensive character.
What is CompuServe ?As the first significant commercial online service provider and "the oldest of the Big Three information services," CompuServe was an American company. It dominated the industry in the 1980s and continued to exert significant impact into the mid-1990s.
CompuServe serves a crucial function as a member of the AOL Web Properties group by offering Internet connections to budget-conscious customers looking for both a dependable connection to the Internet and all the features and capabilities of an online service.
Thus, CompuServe could only be held accountable for defamation if it had actual knowledge of the content's offensive character.
To learn more about CompuServe, follow the link;
https://brainly.com/question/12096912
#SPJ1
/*this function represents
*what karel has to do
*/
function start() {
turnLeft();
buildTower();
turnRight();
if(frontIsClear()){
toMove();
}
while(noBallsPresent();
turnLeft();
buildTower();
}
if(frontIsBlocked()){
goBack();
}
}
/*This represents karel is
*putting down the balls for making the tower
*/
function buildTower(){
putBall();
move();
putBall();
move();
putBall();
}
function
move();
turnRight();
move();
move();
turnLeft();
move();
}
i need help finding the issues
anything
Explanation:
I know what to say this time
Answer:
turn right
Explanation:
i think sorry if it is wrong
narrative report in computer system servicing
Computer servicing is the process of maintaining and repairing computers and computer peripherals. It can involve anything from malware removal and software updates to hardware repairs and troubleshooting. Servicing is often performed by IT professionals.
a really excellent way of getting you started on setting up a workbook to perform a useful function.
Templates a really excellent way of getting you started on setting up a workbook to perform a useful function.
What is the workbook about?One excellent way to get started on setting up a workbook to perform a useful function is to begin by defining the problem you are trying to solve or the goal you want to achieve. This will help you determine the necessary inputs, outputs, and calculations required to accomplish your objective.
Once you have a clear understanding of your goal, you can start designing your workbook by creating a plan and organizing your data into logical categories.
Next, you can start building the necessary formulas and functions to perform the required calculations and operations. This might involve using built-in functions such as SUM, AVERAGE, or IF, or creating custom formulas to perform more complex calculations.
Read more about workbook here:
https://brainly.com/question/27960083
#SPJ1
disadvantages and advantages of relocatable and single user contiguous allocation scheme
Answer:
Relocatable Allocation Scheme:
Advantages:
1. It allows for flexible storage allocation, making it easy to adjust the size of files and folders.
2. It facilitates dynamic linking, which allows multiple processes to share the same code and reduces memory usage.
3. It makes it easier to load and remove programs, as the system can simply adjust the pointers to the relocated memory addresses.
Disadvantages:
1. It requires more complex memory management algorithms, which can slow down the system.
2. Segmentation of memory can occur, leading to fragmented memory over time.
3. It may not be the best choice for small systems, as it requires more overhead.
Single User Contiguous Allocation Scheme:
Advantages:
1. It is simple to implement and requires little overhead, making it ideal for small systems.
2. There is no fragmentation of memory, as each file is stored in a contiguous block of memory.
3. It allows for faster access to files, since they are stored in a contiguous block of memory.
Disadvantages:
1. It can lead to wasted storage space, as files may not fill their allocated blocks entirely.
2. It can be inflexible, as resizing files or directories may require extensive rearrangement of memory.
3. It can be vulnerable to external fragmentation, where space is wasted due to the way files are allocated over time.
Select the correct answer.
Which section of a research paper contains all the sources that are cited in the paper?
ОА.
abstract
OB.
bibliography
OC.
review of literature
OD
analysis
thing
Reset
Next
Answer:
abstract
Explanation:
as it includes the main finding of the work, usually in research papers References cited is where that information would be.
At what age could you retire with $1 million if you started investing at age 25?
Answer:
65 years old
Explanation:
25-year-old would need to save approximately $400 a month to achieve a $1 million balance by age of 65
Select the correct answer.
Jasmine is a software developer. Her upcoming project requires building system software for a manufacturing plant. The software should be
powerful and fast and provide high performance. Which programming language should she use while programming the manufacturing plant's
system software?
OA PHP
OB. Python
C C++
OD. Java
Answer: C++
Explanation: it is correct on PLATO
C++ program
Sort only the even elements of an array of integers in ascending order.
Answer: Here is one way you could write a C++ program to sort only the even elements of an array of integers in ascending order:
Explanation: Copy this Code
#include <iostream>
#include <algorithm>
using namespace std;
// Function to sort only the even elements of an array in ascending order
void sortEvenElements(int arr[], int n)
{
// create an auxiliary array to store only the even elements
int aux[n];
int j = 0;
// copy only the even elements from the original array to the auxiliary array
for (int i = 0; i < n; i++)
if (arr[i] % 2 == 0)
aux[j++] = arr[i];
// sort the auxiliary array using the STL sort function
sort(aux, aux + j);
// copy the sorted even elements back to the original array
j = 0;
for (int i = 0; i < n; i++)
if (arr[i] % 2 == 0)
arr[i] = aux[j++];
}
int main()
{
// test the sortEvenElements function
int arr[] = {5, 3, 2, 8, 1, 4};
int n = sizeof(arr) / sizeof(arr[0]);
sortEvenElements(arr, n);
// print the sorted array
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
return 0;
}
Consider two packet switches directly connected by a link of 5000 km,
propagation speed 2.5 X10^8 m/s and transmission rate 1 Mbps. How long does it take to move
a packet of length 1,000 bytes from one packet switch to the other packet switch? Generally,
how long does it take to move a packet of length L over a link of distance d, propagation speed
s, and transmission rate R bps?
The time that is required for the packet to move over the the distance d at the speed s is 0.028 seconds.
The speed that It would take to move it in transmission is given as 0.008 seconds.
How to solve for the required timeThe details that we would have to solve the problem that we have here are given below
The distance = 5000 km, we convert to meters = 5000 * 1000
The speed of the propagation is given as (s) 2.5 x 108 m/s
The propagation delay is given as d / s
= 5000000 / 2.5 x 10^8
= 0.02 this is the value of the propagation
Next we have to find the length of the packet. L = 1000 bytes
this is equal to 8000 bits
The transmission rate is 1 Mbps = 1000000 bits
The transmission delay would be = L/R
= 8000 / 1000000
= 8 / 1000
= 0.008 seconds in transmission
The total required time that is to be gotten would be
Propagation + transmission
= 0.02 + 0.008
= 0.028
Read more on transmission rate here:
https://brainly.com/question/13013855
#SPJ1
By using ____, you can use reasonable, easy-to-remember names for methods and concentrate on their purpose rather than on memorizing different method names.
Answer:
Polymorphism
Explanation:
If we use polymorphism so we can apply the names that could be easy to remember for the methods' purpose.
The information regarding the polymorphism is as follows:
The person has various attributes at the same timeFor example, a man could be a father, a husband, an entrepreneur at the same time.In this, the similar person has different types of behavior in different situations.Therefore we can conclude that If we use polymorphism so we can apply the names that could be easy to remember for the methods' purpose.
Learn more about the behavior here: brainly.com/question/9152289
Which of the following clauses will stop the loop when the value in the intPopulation variable is less than the number 5000?
Answer:All of the above
Explanation:
please answer urgently. See the attached image
Based on the information, the tight upper bound for T(h) is O(h).
How to explain the informationThe algorithm visits at most x children in line 3, where x is the number of keys in the current node.
T(h) ≤ T(h-1) + x
For a B-Tree of height 0, i.e., a single node, the algorithm just compares the key with the node key and returns. Therefore, T(0) = Θ(1).
We can express T(h) as a sum of terms of the form T(h-i) for i = 1 to h:
T(h) ≤ T(h-1) + x
T(h-1) ≤ T(h-2) + x
T(h-2) ≤ T(h-3) + x
...
T(2) ≤ T(1) + x
T(1) ≤ T(0) + x
Adding all these inequalities, we get:
T(h) ≤ T(0) + xh
Substituting T(0) = Θ(1), we get:
T(h) = O(h)
Therefore, the tight upper bound for T(h) is O(h).
Learn more about upper bound on
https://brainly.com/question/28725724
#SPJ1
Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print the sum of the numbers and their average.
The program that receives a series of numbers from the user is:
theSum = 0.0
# stores the number of terms entered by the user
n = 0
# loop until user presses the enter key
# infinite loop
while True:
# get user input from user
data = input("Enter a number or press Enter to quit: ")
# if user presses enter
if data == '':
# break out of the loop
break
# convert data into float using float()
number = float(data)
# add the entered number to theSum
theSum += number
# increase the number of terms
n += 1
print()
print("The sum is", theSum)
# if numbers of terms entered are greater than 0
if n > 0:
# calculate average
average = theSum / n
print('The average is', average)
# if no terms are entered
else:
print('Average : undefined (as the number of terms entered are 0)')
What is a program?A computer program is a set of instructions written in a programming language that a computer is supposed to obey.
Computer programs are one of the intangible components of the software, which also includes documentation and other components. The version of a computer program that humans can read is called the source code.
Learn more about program on;
https://brainly.com/question/23275071
#SPJ1
Some scientists hypothesize that Earth's ozone layer is being damaged by ____.
a.
ultraviolet radiation
c.
plant life on Earth
b.
chlorofluorocarbons
d.
global warming
Please select the best answer from the choices provided
A
B
C
D
Some scientists hypothesize that Earth's ozone layer is being damaged by the emission of certain chemical compounds known as ozone-depleting substances (ODS), such as chlorofluorocarbons (CFCs).
b. chlorofluorocarbonsWhat are ozone-depleting substances (ODS)?These substances have been widely used in various industrial processes, aerosol propellants, refrigerants, and fire suppression systems. When released into the atmosphere,
CFCs can reach the stratosphere and interact with ozone molecules, leading to their depletion and thinning of the ozone layer. Ultraviolet radiation is a consequence of ozone layer depletion, and global warming, while impacting the Earth's climate, is not directly linked to ozone layer damage.
Plant life on Earth plays a vital role in oxygen production and carbon dioxide absorption but is not a direct cause of ozone layer depletion.
Learn more about ozone layer at
https://brainly.com/question/520639
#SPJ1
Which type of Internet services uses wires similar to telephones?
A.Cable.
B.Fiber-optic.
C.DSL.
D.Satellite.
The type of Internet service which uses wires similar to telephones is: C. DSL.
What is communication?Communication can be defined as a strategic process which involves the transfer of information (messages) from one person (sender) to another (recipient or receiver), especially through the use of semiotics, symbols, signs and network channel such as DSL.
What is DSL?DSL is an abbreviation for Digital Subscriber Line and it can be defined as a type of Internet service which is designed and developed to make use of a two-wire copper telephone line.
In this context, we can reasonably infer and logically deduce that Digital Subscriber Line (DSL) make use of wires just like telephones.
Read more on DSL here: https://brainly.com/question/14599737
#SPJ1
During the projects for this course, you have demonstrated to the Tetra Shillings accounting firm how to use Microsoft Intune to deploy and manage Windows 10 devices. Like most other organizations Tetra Shillings is forced to make remote working accommodations for employees working remotely due to the COVID 19 pandemic. This has forced the company to adopt a bring your own device policy (BYOD) that allows employees to use their own personal phones and devices to access privileged company information and applications. The CIO is now concerned about the security risks that this policy may pose to the company.
The CIO of Tetra Shillings has provided the following information about the current BYOD environment:
Devices include phones, laptops, tablets, and PCs.
Operating systems: iOS, Windows, Android
Based what you have learned about Microsoft Intune discuss how you would use Intune to manage and secure these devices. Your answer should include the following items:
Device enrollment options
Compliance Policy
Endpoint Security
Application Management
I would utilise Intune to enrol devices, enforce compliance regulations, secure endpoints, and manage applications to manage and secure BYOD.
Which version of Windows 10 is more user-friendly and intended primarily for users at home and in small offices?The foundation package created for the average user who primarily uses Windows at home is called Windows 10 Home. It is the standard edition of the operating system. This edition includes all the essential tools geared towards the general consumer market, including Cortana, Outlook, OneNote, and Microsoft Edge.
Is there employee monitoring in Microsoft Teams?Microsoft Teams helps firms keep track of their employees. You can keep tabs on nearly anything your staff members do with Teams, including text conversations, recorded calls, zoom meetings, and other capabilities.
To know more about BYOD visit:
https://brainly.com/question/20343970
#SPJ1
Different between embedded computer &
Micro controllers
An embedded computer is a product that uses a microprocessor as a component. Ie a relationship between a car and its engine. A Microcontroller is a microprocessor that is packaged with RAM, program storage and interface circuitry to make it simple to use
Write a SELECT statement that pulls all of the rows from a single field called LAST_NAME in a table called EMPLOYEE.
The following SELECT statement can be used to pull all rows from a single field called LAST_NAME in a table called the EMPLOYEE:
SELECT LAST_NAME
;
FROM EMPLOYEE
WHERE AGE > 25;
Stream processing in a relational data stream management system or the managing data housed in a relational database management system are two uses for the domain-specific language known as a SQL, also known as the structured query language.
The SELECT statement is an very important part of Structured Query Language (SQL). By using SELECT statements, you can pull data from the tables in a a database to meet your needs.
For more such questions on SQL query
https://brainly.com/question/27851066
#SPJ11
Creation and management of lists worksheet
Answer:
L..............hhhhhhhhhhhhhhhhhhhhhhhjjhhhhhhhh
1.13.5 Circle in a Square
Squircle is termed a Circle in a Square.
What is a Square?A square is a standard quadrilateral, and that implies that it has four equivalent sides and four equivalent points. This is made up of four sides. Also the sides are termed equal in length.
A squircle is a shape moderate between a square and a circle. There are somewhere around two meanings of "squircle" being used, the most well-known of which depends on the superellipse.
"Squircle" is a word that is made up of two words square and a circle. The radius of a circle will be from the center of the said square.
Learn more about Square, here:
https://brainly.com/question/28776767
#SPJ1
The question is incomplete, Complete question probably will be:
What is a Circle in a Square called?
Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex: If the input is: PYTHON the output is: 14
Complete question:
Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex: If the input is: PYTHON
the output is: 14
part of the code:
tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }
Answer:
Complete the program as thus:
word = input("Word: ").upper()
points = 0
for i in range(len(word)):
for key, value in tile_dict.items():
if key == word[i]:
points+=value
break
print("Points: "+str(points))
Explanation:
This gets input from the user in capital letters
word = input("Word: ").upper()
This initializes the number of points to 0
points = 0
This iterates through the letters of the input word
for i in range(len(word)):
For every letter, this iterates through the dictionary
for key, value in tile_dict.items():
This locates each letters
if key == word[i]:
This adds the point
points+=value
The inner loop is exited
break
This prints the total points
print("Points: "+str(points))
Answer:
Here is the exact code, especially if you want it as Zybooks requires
Explanation:
word = input("").upper()
points = 0
for i in range(len(word)):
for key, value in tile_dict.items():
if key == word[i]:
points+=value
break
print(""+str(points))