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.

Answers

Answer 1

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;


Related Questions

<
Subject Test
import java.util.concurrent.*;
public class Main (

public static void main(String[] args)
ConcurrentHashMap chm = new ConcurrentHashMap ();
chm.put(1, "Welcome");
chm.put(2, "to");
chm.put(3, "Java");
chm.put (4, "World");
chm.putIfAbsent (3, "World");
System.out.println("Elements: "+ chm);
chm.remove (2, "Welcome");
System.out.println("Elements after key 2 is removed: "+chm);
chm. putIfAbsent (3, "Java's");
System.out.println("Add new:,"+chm);
chm.replace(3, "Java", "Java New");
System.out.println("After Replacing: "+ chm);

Answers

Answer:

I don't know ... ............

Write a program whose input is two integers and whose output is the two integers swapped. Place the values in an array, where x is position 0 and y is position 1.Ex: If the input is: 3 8 then the output is: 83 Your program must define and call a method: public static void swapValues (int[] "values) LabProgram.java 1 import java.util.Scanner; 23 public class LabProgram 4 5 /* Define your method here 6 7 public static void main(String[args) { 8 /* Type your code here. / 9 } 10 } 11

Answers

Answer:

import java.util.*;

import java.lang.*;

import java.io.*;

class Codechef

{ public static void swapValues(int[] values)

{int temp= values[0];

values[0]=values[1];

values[1]=temp;

System.out.print(values[0]+" "+values[1]);}

public static void main (String[] args) throws java.lang.Exception

{

Scanner sc= new Scanner(System.in);

int A[] = new int[2];

A[0] = sc.nextInt();

A[1]= sc.nextInt();

swapValues(A);

}

}

Input:-

3   8

Output:-

8   3

Input:-

1    2

Output:-

2   1

When in global configuration mode, which steps are necessary to edit an ip address on an Ethernet interface?

Answers

Answer:

I. You should enter interface configuration mode.

II. Configure the IP address and subnet mask.

Explanation:

A node refers to the physical device that make up a network and are capable of sending, receiving, creating and storing data in communication.

Some examples of network nodes are modem, hubs, computer, switches, phone and printers.

In Computer networking, network devices such as routers and switches are usually configured (programmed) through the use of specific network commands commonly referred to as configs e.g show int description, config terminal (config t), show IP address, etc.

In Cisco devices, there are five (5) main types of command modes;

1. Sub-interface configuration mode.

2. Interface configuration mode.

3. Line configuration mode.

4. Router configuration method.

5. Global configuration mode.

Global configuration mode is a configuration mode that avail network engineers and end users with the ability to modify or edit the running (global) system configuration of a networking device. Thus, any change effected at the global configuration mode will affect the network device as a whole.

In global configuration mode, the steps which are necessary to edit an ip address on an Ethernet interface include;

I. You should enter interface configuration mode using the "configure terminal" command.

II. Configure the IP address and subnet mask.

See an example below;

"Router(config-if)# IP address 192.168.1.2 255.255.255.0"

Write a SELECT statement that returns a single value that represents the sum of the largest unpaid invoices submitted by each vendor. Use a derived table that returns MAX(InvoiceTotal) grouped by VendorID, filtering for invoices with a balance due

Answers

Answer:

Create table vendor(vendor_id int,due_invoice int,invoiceTotal int);

Create view v as select vendor_id,max(due_invoice) as unpaid from vendor;

Select sum(unpaid) from v;

Select vendor_id,invoiceTotal from vendor group by vendor_id;

Which of these is unused normal, unvisited link ?? 1. a: link 2 a: visited 3 a: hover

Answers

Answer:

hover

Explanation:

I hope my answer is write

Why is graphics important in multimedia application

Answers

Graphics are important in multimedia application this is because humans are visually oriented etc.

Write a program that divides mystery_value by mystery_value #and prints the result. If that operation results in an #error, divide mystery_value by (mystery_value + 5) and then print the result. If that still fails, multiply mystery_value #by 5 and print the result. You may assume one of those three things will work.
1 mystery_value = 5 2 3 #You may modify the lines of code above, but don't move them! 4 #when you submit your code, we'll change these lines to 5 #assign different values to the variables. 6 I 7 #write a program that divides mystery value by mystery_value 8 #and prints the result. If that operation results in an 9 #error, divide mystery value by (mystery_value + 5) and then 10 #print the result. If that still fails, multiply mystery_value 11 #by. 5 and print the result. You may assume one of those three 12 #things will work, 13 # 14 #You may not use any conditionals. 15 # 16 #hint: You're going to want to test one try/except structure 17 #inside another! Think carefully about whether the second 18 #one should go inside the try block or the except block. 19 20 21 #Add your code here! 22

Answers

Answer:

mystery_value = 5  

try:

   print(mystery_value / mystery_value)

except:

   try:

       print(mystery_value / (mystery_value + 5))

   except:

       print(mystery_value * 5)

It's currently 1:00 in the afternoon. You want to schedule the myapp program to run automatically tomorrow at noon (12:00). What two at commands could you use

Answers

Answer:

at 12 pm tomorrow

at now +23 hours

Explanation:

The at command could be used in the command line to perform a scheduled command in Unix related systems. The at command coule be ua d to program a complex script or used to perform simple scheduled reminders.

The at command is initiated by first writing the at string followed by the condition or statement to be performed.

Currently (1:00 pm) ; To make a schedule for 12pm then that will be at noon the following day:

at 12:00 pm tomorrow

Or :

Using the number of hours between the current tone and the schedule time : 12 pm tomorrow - 1:00 pm today is a difference of 23 hours ;

Hence, it can be written as :

at +23 hours

what are the application areas of the computer ? list them.​

Answers

Answer:

Home. Computers are used at homes for several purposes like online bill payment, watching movies or shows at home, home tutoring, social media access, playing games, internet access, etc. ...

Medical Field.

Entertainment.

Industry.

Education.

Government.

Banking.

Business.

ng questions two features of computer .​

Answers

Explanation:

accuracy, diligence, versatility

What is garbage in garbage out?​

Answers

Answer: it means if you give a bad input it will result in a ad output.

Explanation:

It has n acronym GIGO which refers to how the quality of an output is determined by the quality of input.

Garbage is trash info... or input. And grabage out is the trash output.

major characteristics of the bus in computer architecture​

Answers

Answer:

A bus is characterized by the amount of information that can be transmitted at once. This amount, expressed in bits, corresponds to the number of physical lines over which data is sent simultaneously. A 32-wire ribbon cable can transmit 32 bits in parallel.

In computer architecture, a bus (related to the Latin “omnibus”, meaning “for all”) is a communication system that transfers data between components inside a computer, or between computers. This expression covers all related hardware components (wire, optical fiber, etc.)

Explanation:

Select the correct statement(s) regarding PONS. a. only MMF cables can be used, since MMF enables greater data capacities compared to SMF b. PONS systems require active amplifiers, since high frequency signals attenuate quickly over distance c. PONS systems use passive devices between OLT and ONT d. all are correct statements

Answers

Answer:

The correct statement regarding PONS is:

c. PONS systems use passive devices between OLT and ONT

Explanation:

PON means Passive Optical Network. Based on fiber-optic telecommunications technology, PON is used to deliver broadband network access to individual end-customers.  It enables a single fiber from a service provider to maintain an efficient broadband connection for multiple end-users (homes and small businesses).  OLT means Optical Line Terminal, while ONT means Optical Network Terminal.  They provide access to the PON.

which animal is the computer to store data information and instruction ​

Answers

Answer:

human is the answwr of the quest

two reasons for compressing files before uploading them to cloud storage​

Answers

Answer:

Storage. File compression reduces the amount of space needed to store data. Using compressed files can free up valuable space on a hard drive, or a web server. Some files, like word files, can be compressed to 90 percent of their original size.

Explanation:

The main advantages of compression are reductions in storage hardware, data transmission time, and communication bandwidth. This can result in significant cost savings. Compressed files require significantly less storage capacity than uncompressed files, meaning a significant decrease in expenses for storage.

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers.

Ex: If the input is
5 50 60 140 200 75 100

the output is
50 60 75

Answers

Answer:

The program in Python is as follows:

num = int(input())

numList = []

for i in range(num+1):

   numInput = int(input())

   numList.append(numInput)

for i in range(len(numList)-1):

   if numList[i] <= numList[-1]:

       print(numList[i],end=" ")

Explanation:

This gets input for the number of integers

num = int(input())

This initializes an empty list

numList = []

This iterates through the number of integers and gets input for each

for i in range(num+1):

   numInput = int(input())

The inputs including the threshold are appended to the list

   numList.append(numInput)

This iterates through the list

for i in range(len(numList)-1):

All inputs less than or equal to the threshold are printed

   if numList[i] <= numList[-1]:

       print(numList[i],end=" ")

Select the correct answer.
Adam is part of a software design team assigned to create the interface for a kiosk application. What tool will he use to design the interface?
A.
timing chart
B.
pseudocode
C.
block diagram
D.
data dictionary

Answers

I will say that the answer is b

Answer:

its not block diagram

it could be data dictionary

Explanation:

As you are working on the Datacenter Edition server, you install a card to connect a set of RAID drives. After the card and drives are set up, you run the installation disc that accompanies the RAID drives and card. When you reboot the server, you get a message about problems with two .dll files. What has most likely happened and how can you fix it

Answers

Answer:

by fixing it with card

Explanation:

you have taken out the card I thing

what is the memory of the five generations of computers?​

Answers

Answer: Magnetic drum

Explanation: First generation computers used magnetic drum for memory

Answer:

What is the memory of the five generations of computers?​

The answer is Magnetic drum because First generation computers used magnetic drum for memory.

Hope this helps you :)

Select the correct answer.
Which design diagram uses the crow’s foot notation to show cardinality?
A.
activity diagram
B.
ER diagram
C.
class diagram
D.
flowchart
E.
sequence diagram

Answers

Answer:

B

Explanation:

In an ERD, the Crow Foot Notation Symbols are used with cardinality.

Hope it helps you

Write a recursive function num_eights that takes a positive integer pos and returns the number of times the digit 8 appears in pos

Answers

Answer:

Explanation:

The following is written in Java. It creates the function num_eights and uses recursion to check how many times the digit 8 appears in the number passed as an argument. A test case has been created in the main method and the output can be seen in the image below highlighted in red.

  public static int num_eights(int pos){

       if (pos == 0)

           return 0;

       if (pos % 10 == 8)

           return 1 + num_eights(pos / 10);

       else

           return num_eights(pos / 10);

   }

the computer that process data that are represented in the form of discrete values are called​

Answers

Answer:

Digital computer

Explanation:

The computer that process data that are represented in the form of discrete values are called digital computer.


A chain of dry-cleaning outlets wants to improve its operations by using data from
devices at individual locations to make real-time adjustments to service delivery.
Which technology would the business combine with its current Cloud operations
to make this possible?
O Edge Computing
O Blockchain
O Data Visualization
O Public Cloud

Answers

A










explanation cause it is

There is an interface I that has abstract class AC as its subclass. Class C inherits AC. We know that C delegates to an object of D to perform some computations. Besides, C consists of two C1s and one C2 as subcomponents. Object of C2 is still reusable when its major component C is depleted. C1 has a method that takes in an object of E as argument. Which one is invalid

Answers

Answer:

are u in HS or college work

I am trying to understand

User-Defined Functions: Miles to track lapsOne lap around a standard high-school running track is exactly 0.25 miles. Define a function named MilesToLaps that takes a float as a parameter, representing the number of miles, and returns a float that represents the number of laps.Then, write a main program that takes a number of miles as an input, calls function MilesToLaps() to calculate the number of laps, and outputs the number of laps. Ex: If the inout is 1.5the output is 6.0 Ex: If the input is 2.2the output is 8.8 Your program should define and call a function Function Miles ToLaps(float userMiles) returns float userLaps 12 // Deine Milestola hert. 34 // Deine Minhert. Your code ust call llestola 5

Answers

Answer:

Explanation:

The following is written in Java. The MilesToLaps method creates a variable called laps and gives it the value of the input parameter miles divided by 0.25. Then it returns the variable laps to the user. In the main method a Scanner object was created and asks the user for the number of miles which are passed to the MilesToLaps method which returns the number of laps. This can be seen in the attached image below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("How many miles?");

       float miles = in.nextFloat();

      System.out.println("This is " + MilesToLaps(miles) + " laps");

   }

   public static float MilesToLaps(float miles) {

       float laps = (float) (miles / 0.25);

       return laps;

   }

}

This criterion is linked to a Learning OutcomeCreate checkDuplicates method that receives an array of ints, and an int as parameters. It will return true if the int is found in the array, and false if the int is NOT found in the array. Call the checkDuplicates method from both the MegaMillionsLottery constructor, and the getUserPicks() method.

Answers

Answer:

Explanation:

The MegaMillions Lottery class was not provided and neither was the getUserPicks() method. Since they were not found online either, I have created the checkDuplicates method so that it works standalone. Therefore, you can simply call the method from wherever you need by pasting the call line where it needs to be called. A test case has been created in the main method so that you can see the method in action. The output is seen in the attached image below.

   public static boolean checkDuplicate(int[] myArr, int element) {

       for (int x : myArr) {

           if (x == element) {

               return true;

           }

       }

       return false;

   }

GuardIN is an IT security firm. It deals with highly secure data for a wide variety of software and e-commerce agreements, trademark licenses, and patent licenses. GuardIN needs a cloud computing option that would allow it to purchase and maintain the software and infrastructure itself. The cloud also needs to be designed in such a way that all users of the organization can access it without any lag. Which cloud computing option would be most suitable for GuardIN?

Answers

Answer:

GuardIN is an IT security firm. It deals with highly secure data for a wide variety of software and e-commerce agreements, trademark licenses, and patent licenses. GuardIN needs a cloud computing option that would allow it to purchase and maintain the software and infrastructure itself. The cloud also needs to be designed in such a way that all users of the organization can access it without any lag. Which cloud computing option would be most suitable for GuardIN?

Explanation:

Use the Internet to research external storage devices. Find at least three devices, with a minimum storage size of 1 terabyte (TB), from three different manufacturers. Write a paragraph, IN YOUR WORDS, for each device explaining the features and benefits. Provide the retail cost and include a reference link to each device. Next, write

Answers

Hi, you've asked an incomplete question. However, I provided suggestions on getting the desired information.

Explanation:

Considering the fact that you are required to find information about not just the cost, but also the features and benefits of three storage devices having a minimum storage size of 1 terabyte, it is recommended that you check this on a reputable e-commerce site (eg Amazon).

There you could find information about their features and benefits, as well as customer feedback about their experience using these devices.

In which generation of computers are we in?​

Answers

It should be the Sixth generation

Write and test a program that computes the area of a circle. This program should request a number representing a radius as input from the user. It should use the formula 3.14 * radius ** 2 to compute the area and then output this result suitably labeled.

Answers

Answer:

mark me brainlist

Explanation:

Other Questions
HELP ASAP!! Image point N'(12, -6) was dilated from the pre-image point N(4, -2). What was the scale factor used?A. 1/3B. 3 c. 1/4D. 4 Format wars, in the context of high-technology industries, refer to: a. battles to control the source of differentiation, and thus the value that such differentiation can create for the customer. b. the confusion among customers that arises as a result of several choices of formats for PCs and other gadgets. c. the price-based battles in the network of complementary products, which is a primary determinant of the demand for an industry's product. d. conflicts within an organization about which format to adopt for their products. e. price-based battles among companies producing similar products. write 5 functions of high court of nepal evaluate the following 3^2 divided by (2+1) A Circuit has a 5000 V power supply(AC), A load resistance of 4 ohms and open switch how much Current will flow in a circuit as it is ? Help, can someone translate this Buenas NochesBuenos Dias insert 3 rational no. between 4/13 and 1/13 Factor the expression completely.-20% -40A. -20(x-2)B. -10(2x - 10)C.-20(x + 2)D. -10(2x + 10) Im a photoelectric effect, which property of the incident light determines how much kinetic energy the ejected electrons have ? A) brightness B) frequency C) size of the beam D) none of the above which of the following statements is true about alkali? A) bases that soluble in water B) shows a pH value less than 7 C) Ionises in water to form hydroxonium ions D) Reacts with carbonate salt to release carbon dioxide gas pls find the volume :)) Can someone help me with this I don't understand find TAN help me please............................................ A stone is dropped of a 1296-ft-cliff. The height of the stone above the ground is given by the equation h= - 16t^2+1296, where h is the stones height in feet, and t is the time in seconds after the stone is dropped. Find the time required for the stone to hit the ground. Find the equation of the line thatis parallel to y = 4x + 1 andcontains the point (1, 1).y = [? ]X + [ ] who discovered about the green house effect and when . can uh help in in this question step by step For a line that contains the point (3, 4) and has a slope of 4, please name another point on this line. Show the work you did to find this answer. If one ruler and three pencils cost N120 and tworulers and one pencil cost N140. Find the cost ofone ruler and one pencil