Answer:
It is a C++ program :
#include <iostream> // to use input output functions
using namespace std; //to identify objects like cin cout
//following are the prototypes for the four functions placed above main
void displayMenu();
void findSquareArea();
void findCircleArea();
void findTriangleArea();
//definition for constant PI out of main
const float PI = 3.14159;
int main(){ //start of main function
displayMenu(); //calls displayMenu() method
}
void displayMenu(){ // to make user selection and calls relevant function to compute area according to the choice of user
int selection=0; //to choose from 4 options
cout<<"Program to calculate areas of objects:\n" ; //displays this message at start
do { //this loop asks user to enter a choice and this continues to execute and calculate depending on users choice until user enters 4 to exit
cout<<"\n1.Square \n2.Circle \n3.Right Triangle \n4.Quit";
cout<<"\nEnter your choice:"; //prompts user to enter choice
cin>>selection; //reads the input choice
if(selection==1) //if user enters 1
{ //computes area of square by calling findSquareArea
findSquareArea(); //function call to the findSquareArea function
}
else if(selection==2) //if user enters 2
{ //computes area of circle by calling findCircleArea
findCircleArea(); //function call to the findCircleArea function
}
else if(selection==3) //if user enters 3
{ //computes area of triangle by calling findTriangleArea
findTriangleArea(); //function call to the findTriangleArea function
}
else if(selection==4) //if user enters 4
{
cout<<"\nTerminating!!."; //exits after displaying this message
break;
}
else // displays the following message if user enters anything other than the given choices
{
cout<<"\nInvalid selection"; //displays this message
}
}
while(1);
}
void findSquareArea(){ //function definition. this function has no parameters
float area=0.0; //variable to store the area of square
float side=0; //local variable of this method that stores value of side of square
cout<<"\nLength of side: "; //prompts user to enter length of side
cin>>side; //reads value of side from user
area=side*side; //formula to compute area of square and result is assigned to area variable
cout<<"\nArea of Square: "<<area<<endl; //displays are of the square
}
void findCircleArea(){ //function definition. this function has no parameters
float area=0.0; //variable to store the area of square
float radius=0.0; //local variable of this method that stores value of radius of circle
cout<<"\nRadius of circle: "; //prompts user to enter radius of circle
cin>>radius; // reads input value of radius
area=PI*radius*radius; //formula to compute area of circle
cout<<"\nArea of circle: "<<area<<endl;} //displays are of the circle
void findTriangleArea(){ //function definition. this function has no parameters
float area=0.0; //variable to store the area of triangle
float base=0.0; //local variable of this method that stores value of base of triangle
float height=0.0; //holds value of height of triangle
cout<<"\nHeight of Triangle: "; //prompts user to enter height
cin>>height; //reads input value of height
cout<<"\nBase of Triangle: "; //prompts user to enter base
cin>>base; //reads input value of base
area=0.5*height*base; //computes area of triangle and assign the result to area variable
cout<<"\nArea of Triangle: "<<area<<endl; //displays area of triangle
}
Explanation:
The program is modified as above. The prototypes for the four functions that are named as :
void displayMenu(); to display the Menu of choices and call relevant function to compute area
void findSquareArea(); To compute area of square
void findCircleArea(); To compute area of circle
void findTriangleArea(); To compute area of triangle
Note that these methods have no parameters and their return type is void. These 4 methods prototypes are placed above main() function.
Next the function definitions (consisting of a function header and initially empty body) for the four functions are written and placed below main() For example definition of findTriangleArea() is given below:
void findTriangleArea()
{
}
Next the code in the main is moved to the relevant methods. Then variables selection=0; is moved to displayMenu method, radius=0.0 to findCircleArea method , side=0; to findSquareArea float area=0.0; to each method, float height=0.0; and float base=0.0; to findTriangleArea method.
The relevant code moved to each method is shown in the above code.
The definition for the named constant PI is moved out of main and placed above the main function. const keyword before datatype of PI variable shows that PI is declared constant and its value is initialized once only to 3.14159.
Write a program that asks for the weight of a package and the distance it is to be shipped. This information should be passed to a calculateCharge function that computes and returns the shipping charge to be displayed . The main function should loop to handle multiple packages until a weight of 0 is entered.
Answer:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int WEIGHT_MIN = 0,
WEIGHT_MAX = 20,
DISTANCE_MIN = 10,
DISTANCE_MAX = 3000;
float package_weight,
distance,
total_charges;
cout << "\nWhat is the weight (kg) of the package? ";
cin >> package_weight;
if (package_weight <= WEIGHT_MIN ||
package_weight > WEIGHT_MAX)
{
cout << "\nWe're sorry, package weight must be\n"
<< " more than 0kg and less than 20kg.\n"
<< "Rerun the program and try again.\n"
<< endl;
}
else
{
cout << "\nDistance? ";
cin >> distance;
if (distance < DISTANCE_MIN ||
distance > DISTANCE_MAX)
{
cout << "\nWe're sorry, the distance must be\n" << "within 10 and 3000 miles.\n"
<< "Rerun the program and try again.\n"
<< endl;
}
else
{
if (package_weight <= 2)
total_charges = (distance / 500) * 1.10;
else if (package_weight > 2 &&
package_weight <= 6)
total_charges = (distance / 500) * 2.20;
else if (package_weight > 6 &&
package_weight <= 10)
total_charges = (distance / 500) * 3.70;
else if (package_weight > 10 &&
package_weight <= 20)
total_charges = (distance / 500) * 4.80;
cout << setprecision(2) << fixed
<< "Total charges are $"
<< total_charges
<< "\nFor a distance of "
<< distance
<< " miles\nand a total weight of "
<< package_weight
<< "kg.\n"
<< endl;
}
}
Explanation:
In Network Address and Port Translation (NAPT), which best describes the information used in an attempt to identify the local destination address?
Answer:
Hello your question lacks the required options here are the options
source IP and destination IPsource IP and destination portsource IP and source portsource port and destination IPsource port and destination portanswer : source IP and destination port
Explanation:
The information that is used in an attempt to identify the local destination address is the source IP and destination port
source IP is simply the internet protocol address of a device from which an IP packet is sent to another device while destination port are the ports found in a destination device that receives IP packets from source ports they are found in many internet applications
5- The Menu key or Application key is
A. is the placements and keys of a keyboard.
B. a telecommunications technology used to transfer copies of documents
c. a key found on Windows-oriented computer keyboards.
Answer:
c. a key found on Windows-oriented computer keyboards.
Explanation:
Hope it helps.
What is the absolute pathname of the YUM configuration file? REMEMBER: An absolute pathname begins with a forward slash
Answer:
/etc/yum.conf
Explanation:
The absolute pathname for YUM is /etc/yum.conf. The configuration file For yum and related utilities can be found there. The file has one compulsory section, and this section can be used to place Yum options with global effect, it could also have one or more sections, that can enable you to set repository-specific options.
7. When using find command in word we can search?
a. Characters
b. Formats
c. Symbols
d. All of the above
Answer:
When using find command in word we can search all of the above
A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), the amount of the sale, and the date of that event. Write a program that reads such a file and displays the total amount for each service category. Display an error if the file does not exist or the format is incorrect.
Answer:
Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?
Explanation:
Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?Life can get busy and hectic, but relationships matter. What is an effective way of mending relationships that may have had been neglected?
Implement function easyCrypto() that takes as input a string and prints its encryption
defined as follows: Every character at an odd position i in the alphabet will be
encrypted with the character at position i+1, and every character at an even position i
will be encrypted with the character at position i 1. In other words, ‘a’ is encrypted with
‘b’, ‘b’ with ‘a’, ‘c’ with ‘d’, ‘d’ with ‘c’, and so on. Lowercase characters should remain
lowercase, and uppercase characters should remain uppercase.
>>> easyCrypto('abc')
bad
>>> easyCrypto('Z00')
YPP
Answer:
The program written in python is as follows;
import string
def easyCrypto(inputstring):
for i in range(len(inputstring)):
try:
ind = string.ascii_lowercase.index(inputstring[i])
pos = ind+1
if pos%2 == 0:
print(string.ascii_lowercase[ind-1],end="")
else:
print(string.ascii_lowercase[ind+1],end="")
except:
ind = string.ascii_uppercase.index(inputstring[i])
pos = ind+1
if pos%2 == 0:
print(string.ascii_uppercase[ind-1],end="")
else:
print(string.ascii_uppercase[ind+1],end="")
anystring = input("Enter a string: ")
easyCrypto(anystring)
Explanation:
The first line imports the string module into the program
import string
The functipn easyCrypto() starts here
def easyCrypto(inputstring):
This line iterates through each character in the input string
for i in range(len(inputstring)):
The try except handles the error in the program
try:
This line gets the index of the current character (lower case)
ind = string.ascii_lowercase.index(inputstring[i])
This line adds 1 to the index
pos = ind+1
This line checks if the character is at even position
if pos%2 == 0:
If yes, it returns the alphabet before it
print(string.ascii_lowercase[ind-1],end="")
else:
It returns the alphabet after it, if otherwise
print(string.ascii_lowercase[ind+1],end="")
The except block does the same thing as the try block, but it handles uppercase letters
except:
ind = string.ascii_uppercase.index(inputstring[i])
pos = ind+1
if pos%2 == 0:
print(string.ascii_uppercase[ind-1],end="")
else:
print(string.ascii_uppercase[ind+1],end="")
The main starts here
This line prompts user for input
anystring = input("Enter a string: ")
This line calls the easyCrypto() function
easyCrypto(anystring)
state five uses of building
Programming Challenge: Test Average CalculatorUsing a variable length array, write a C program that asks the user to enter test scores.Then, the program should calculate the average, determine the lowest test score, determine the letter grade, and display all three.
Answer:
well you could use variables in C and display them
Explanation:
Why do you think it is necessary to set the sequence in which the system initializes video cards so that the primary display is initialized first
Answer:
Because if you don't do it BIOS doesn't support it. ... In troubleshooting a boot problem what would be the point of disabling the quick boot feature in BIOS setup
Explanation:
What is the main advantage of using DHCP? A. Allows you to manually set IP addresses B. Allows usage of static IP addresses C. Leases IP addresses, removing the need to manually assign addresses D. Maps IP addresses to human readable URLs
Answer: DHCP (dynamic host configuration protocol) is a protocol which automatically processes the configuring devices on IP networks.It allows them to to use network services like: NTP and any communication proto cal based on UDP or TCP. DHCP assigns an IP adress and other network configuration parameters to each device on a network so they can communicate with other IP networks. it is a part of DDI solution.
Explanation:
An app developer is shopping for a cloud service that will allow him to build code, store information in a database and serve his application from a single place. What type of cloud service is he looking for?
Answer:
Platform as a Service (PaaS).
Explanation:
In this scenario, an app developer is shopping for a cloud service that will allow him to build code, store information in a database and serve his application from a single place. The type of cloud service he is looking for is a platform as a service (PaaS).
In Computer science, Platform as a Service (PaaS) refers to a type of cloud computing model in which a service provider makes available a platform that allow users (software developers) to build code (develop), run, store information in a database and manage applications over the internet.
The main purpose of a Platform as a Service (PaaS) is to provide an enabling environment for software developers to code without having to build and maintain complex infrastructure needed for the development, storage and launching of their software applications.
Simply stated, PaaS makes provision for all of the software and hardware tools required for all the stages associated with application development over the internet (web browser).
Hence, the advantage of the Platform as a Service (PaaS) is that, it avails software developers with enough convenience as well as simplicity, service availability, ease of licensing and reduced costs for the development of software applications.
These are the different types of Platform as a Service;
1. Private PaaS.
2. Public PaaS.
3. Hybrid PaaS.
4. Mobile PaaS.
5. Communications PaaS.
6. Open PaaS.
The software developers can choose any of the aforementioned types of PaaS that is suitable, effective and efficient for their applications development. Some examples of PaaS providers are Google, Microsoft, IBM, Oracle etc.
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are three frames within our system. Using the FIFO replacement algorithm, what is the number of page faults for the given reference string?
Answer:
223 8s an order of algorithm faults refrénce fifio 14 suppose in 14 and 123 no need to take other numbers
Which of these statements are true about managing through Active Directory? Check all that apply.
Answer:
ADAC uses powershell
Domain Local, Global, and Universal are examples of group scenes
Explanation:
Active directory software is suitable for directory which is installed exclusively on Windows network. These directories have data which is shared volumes, servers, and computer accounts. The main function of active directory is that it centralizes the management of users.
It should be noted thst statements are true about managing through Active Directory are;
ADAC uses powershellDomain Local, Global, and Universal are examples of group scenes.Active Directory can be regarded as directory service that is been put in place by Microsoft and it serves a crucial purpose for Windows domain networks.
It should be noted that in managing through Active, ADAC uses powershell.
Therefore, in active directory Domain Local, Global, and Universal are examples of group scenes .
Learn more about Active Directory at:
https://brainly.com/question/14364696
A program is considered portable if it . . . can be rewritten in a different programming language without losing its meaning. can be quickly copied from conventional RAM into high-speed RAM. can be executed on multiple platforms. none of the above
Answer:
Can be executed on multiple platforms.
Explanation:
A program is portable if it is not platform dependent. In other words, if the program is not tightly coupled to a particular platform, then it is said to be portable. Portable programs can run on multiple platforms without having to do much work. By platform, we essentially mean the operating system and hardware configuration of the machine's CPU.
Examples of portable programs are those written in;
i. Java
ii. C++
iii. C
Without data compression, and focusing only on the data itself without any overhead, what transmission rate is required to send 30 frames per second of gray-scale images with resolution 1280 x 1024?
Answer:
315 Mbps
Explanation:
Given data :
30 frames per second
resolution = 1280 * 1024
what transmission rate is required can be calculated as
frames per second = rendered frames / number of seconds passed
30 = 30 / 1
Transmission rate = the rate at which the images are transmitted from source to destination =315 Mbps without data compression
What is a what if analysis in Excel example?
Answer:
What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The following example helps you master what-if analysis quickly and easily.
Assume you own a book store and have 100 books in storage. You sell a certain % for the highest price of $50 and a certain % for the lower price of $20.
(i really hope this is what u needed)
What is industry 4.0 -automation revolution-, what is your opinion about the direction this revolution is taking the industry in, and discuss the fate of unskilled and semi-skilled workers affected by industry 4.0.
Answer:
Find the explanation below.
Explanation:
1. Industry 4.0 -automation revolution is a term first used in Germany in 2011 to describe the fourth generation of the industrial revolution. It is the incorporation of digitalized procedures that use smart technology that can work in real-time to industrial production. This means that the machines used in production can independently interact between themselves to accomplish tasks that would otherwise have needed human involvement.
2. My opinion regarding this industrial revolution is that it is a welcome development for businesses because it will help them execute projects at faster rates and limit some working expenses.
3. Unskilled and Semi-skilled workers will be badly affected by this revolution because tasks ordinarily performed by them would be mostly taken over by these machines. This means that companies would most likely lay off these workers whose jobs would now be performed by machines. Job regulation agencies would do well to seek ways to intervene for this group of workers. They may also have to improve their skills if they want to remain relevant to their jobs.
The revolution, however, would be favorable for high-skilled workers because they would be needed to perform jobs such as the maintenance and programming of these machines.
3.16 (Gas Mileage) Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. Develop a program that will input the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful. After processing all input information, the program should calculate and print the combined miles per gallon obtained for all tankfuls. Here is a sample input/output dialog:
Answer:
I am writing a C program.
#include <stdio.h> // for using input output functions
#include <stdbool.h> // for using a bool value as data type
int main() { // start of the main() function body
int count=0; //count the number of entries
double gallons, miles, MilesperGallon, combined_avg, sum; //declare variables
while(true) {// takes input gallons and miles value from user and computes avg miles per gallon
printf( "Enter the gallons used (-1 to stop): \n" ); //prompts user to enter value of gallons or enter -1 to stop
scanf( "%lf", &gallons );//reads the value of gallons from user
if ( gallons == -1 ) {// if user enters -1
combined_avg = sum / count; //displays the combined average by dividing total of miles per drives to no of entries
printf( "Combined miles per gallon for all tankfuls: %lf\n", combined_avg ); //displays overall average value
break;} //ends the loop
printf( "Enter the miles driven: \n" ); //if user does not enter -1 then prompts the user to enter value of miles
scanf( "%lf", &miles ); //read the value of miles from user
MilesperGallon = miles / gallons; //compute the miles per gallon
printf( "The miles per gallon for tankful: %lf\n", MilesperGallon ); //display the computed value of miles per gallon
sum += MilesperGallon; //adds all the computed miles per gallons values
count += 1; } } //counts number of tankfuls (input entries)
Explanation:
The program takes as input the miles driven and gallons used for each tankful. These values are stored in miles and gallons variables. The program calculates and displays the miles per gallon MilesperGallon obtained for each tankful by dividing the miles driven with the gallons used. The while loop continues to execute until the user enters -1. After user enters -1, the program calculates and prints the combined miles per gallon obtained for all tankful. At the computation of MilesperGallon for each tankful, the value of MilesperGallon are added and stored in sum variable. The count variable works as a counter which is incremented to 1 after each entry. For example if user enters values for miles and gallons and the program displays MilesperGallon then at the end of this iteration the value of count is incremented to 1. This value of incremented for each tankful and then these values are added. The program's output is attached.
An organization is struggling to differentiate threats from normal traffic and access to systems. A security engineer has been asked to recommend a system that will aggregate data and provide metrics that will assist in identifying malicious actors or other anomalous activity throughout the environment. Which of the following solutions should the engineer recommend?a. Web application firewall b. SIEM c. IPS d. UTM e. File integrity monitor
Answer:
b. SIEM.
Explanation:
In this scenario, an organization is struggling to differentiate threats from normal traffic and access to systems. A security engineer has been asked to recommend a system that will aggregate data and provide metrics that will assist in identifying malicious actors or other anomalous activity throughout the environment. The solution the engineer should recommend is the Security information and event management (SIEM).
Security information and event management is an enterprise software that provides a holistic view and analyzes activity from various resources across an entire information technology (IT) infrastructure.
The SIEM is used to aggregate important data from multiple source such as servers, routers, firewall, switches, domain controllers, antivirus software and analyzes the data to detect any threat, deviation from the norm, as well as investigate in order to take appropriate actions. Some examples of the SIEM system are IBM QRadar, Splunk, LogRhythm etc.
A bit shift is a procedure whereby the bits in a bit string are moved to the left or to the right.
For example, we can shift the bits in the string 1011 two places to the left to produce the string 1110. Note that the leftmost two bits are wrapped around to the right side of the string in this operation.
Define two scripts, shiftLeft.py and shiftRight.py, that expect a bit string as an input.
The script shiftLeft shifts the bits in its input one place to the left, wrapping the leftmost bit to the rightmost position.
The script shiftRight performs the inverse operation.
Each script prints the resulting string.
An example of shiftLeft.py input and output is shown below:
Enter a string of bits: Hello world!
ello world!H
An example of shiftRight.py input and output is shown below:
Enter a string of bits: Hello world!
!Hello world
Answer:
Following are the code to this question:
Defining method shiftLeft:
def shiftLeft(bit_string): #defining method shiftLeft, that accepts parameter bit_string
bit_string= bit_string[1:]+bit_string[0]#use bit_string to provide slicing
return bit_string#return bit_string value
bit_string =input("Enter value: ")#defining bit_string variable for user input
print (shiftLeft(bit_string))#use print method to call shiftLeft method
Defining method shiftRight:
def shiftRight(bit_string):#defining method shiftRight, which accepts bit_string variable
bit_string=bit_string[len(bit_string)-1]+bit_string[0:len(bit_string)-1]#using bit_string variable for slicing
return bit_string#return bit_string calculated value
bit_string= input("Enter value: ")#defining bit_string variable for user input
print(shiftRight(bit_string))#use print method to call shiftLeft method
Output:
Please find the attachment.
Explanation:
method description:
In the above-given python code two methods "shiftLeft and shiftRight" are declared, in which both the method accepts a string variable "bit_string". Inside methods, we use the slicing, in which it provides to use all the sequence values and calculated the value in this variable and return its value. At the last step, the bit_string variable is used to input value from the user end and call the method to print its value.Steve wants to take charge of his finances. To do so, he must track his income and expenditures. To accurately calculate his take-home pay, Steve must use his __________.
Answer:brain
Explanation:
to think
Discuss the differences between dimensionality reduction based on aggregation and dimensionality reduction based on techniques such as PCA and SVD.
Answer:
Following are the difference to this question can be defined as follows:
Explanation:
In terms of projections of information into a reduced dimension group, we can consider the dimension structure of PCA and SVD technologies. In cases of a change in the length, based on consolidation, there's also a unit with dimensions. When we consider that the days have been aggregated by days or the trade of a commodity can be aggregated to both the area of the dimension, accumulation can be seen with a variance of dimension.Dimensionality reduction based on aggregation involves selection of important character and variable from a large variable and dimensionality reduction based on techniques with the use of PCA and SVD.
What is dimensionality?Dimensionality involves reducing features that have been written or identified or constructing less features from a pool of important features.
Principal components analysis(PCA) and Single value decomposition(SVD) is a form or analysis that can be used to reduce some character that are not important to an information and can also help to select important variables from among many variables.
Therefore, dimensionality reduction based on aggregation involves selection of important character and variable from a large variable and dimensionality reduction based on techniques with PCA and SVD.
Learn more on dimensional analysis here,
https://brainly.com/question/24514347
Assume a PHP document named hello.php has been saved in a folder named carla inside the htdocs folder on your computer. Which is the correct path to enter to view this page in a browser?
The available options are:
A. localhost/Carla/hello.php
B. localhost/htdocs/hello.php
C. localhost/htdocs/Carla/hello.php
D. carla/hello.php5
Answer:
C. localhost/htdocs/Carla/hello.php
Explanation:
A path in computer programming can be defined as the name of a file or directory, which specifies a unique location in a file system.
Therefore, to get the correct path to enter to view this page in a browser, one needs to follow the directory tree hierarchy, which is expressed in a string of characters in which path components, separated by a delimiting character, represent each directory.
Hence, correct path to enter to view this page in a browser is "localhost/htdocs/Carla/hello.php"
For the Python program below, will there be any output, and will the program terminate?
while True: while 1 > 0: break print("Got it!") break
a. Yes and no
b. No and no
c. Yes and yes
d. No and yes
e. Run-time error
You are a project manager for Laredo Pioneer's Traveling Rodeo Show. You're heading up a project to promote a new line of souvenirs to be sold at the shows. You are getting ready to write the project management plan and know you need to consider elements such as policies, rules, systems, relationships, and norms in the organization. Which of the following is not true? A These describe the authority level of workers, fair payment practices, communication channels, and the like. B This describes organizational governance framework. C This describes management elements. D This is part of the EEF input to this process.
Answer:
A. These describe the authority level of workers, fair payment practices, communication channels, and the like.
Explanation:
As seen in the question above, you have been asked to write the project management plan and know that you need to consider elements such as policies, rules, systems, relationships and standards in the organization. These elements are part of EEF's entry into this process, in addition they are fundamental and indispensable for the description not only of the organizational governance structure, but also describe the management elements that will be adopted and used.
However, there is no way to use them to describe the level of authority of workers, fair payment practices, communication channels and the like, as this is not the function of this.
You turn on your Windows computer and see the system display POST messages. Then the screen goes blank with no text. Which of the following items could be the source of the problem?
1. The video card
2. The monitor
3. Windows
4. Microsoft word software installed on the system.
Volume of Pyramid = A*h/3 where A is the area of the base of the pyramid and h is the height of the pyramid. Write a C++ program that asks the user to enter the necessary information about the pyramid (note that the user would not know the area of the base of the pyramid, you need to ask them for the length of one of the sides of the base and then calculate the area of the base). Using the information the user input, calculate the volume of the pyramid. Next display the results (rounded to two decimal places). Example Output (output will change depending on user input): The area of the base of the pyramid is: 25.00 The height of the pyramid is: 5.00 The volume of the pyramid is: 41.67 *Pseudocode IS required for this program and is worth 1 point. The program IS auto-graded.
Answer:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double side, height;
cout<<"Enter the length of one of the sides of the base: ";
cin>>side;
cout<<"Enter the height: ";
cin>>height;
double area = side * side;
double volume = area * height / 3;
cout<<"The area of the base of the pyramid is: "<<area<<endl;
cout<<"The height of the pyramid is: "<<height<<endl;
cout<<"The volume of the pyramid is: "<<fixed<<setprecision(2)<<volume<<endl;
return 0;
}
Pseudocode:
Declare side, height
Get side
Get height
Set area = side * side
Set volume = area * height / 3
Print area
Print height
Print volume
Explanation:
Include <iomanip> to have two decimal places
Declare the side and height
Ask the user to enter side and height
Calculate the base area, multiply side by side
Calculate the volume using the given formula
Print area, height and volume (use fixed and setprecision(2) to have two decimal places)
Identify five key technologies/innovations and discuss their advantages and disadvantages to developing countries like Ghana.
Answer:
The key technology/ innovation advantage and disadvantage can be defined as follows:
Explanation:
Following are the 5 innovations and technology, which promote the other development goals, like renewable energy, quality of jobs, and growth of economic with the good health and very well-being:
1) The use of crop monitoring drone technology promotes sustainable farming.
2) The production of plastic brick including highways, floors, and houses.
3) The new banking market or digital banking.
4) E-commerce site.
5) Renewable energy deployment such as solar panels.
Advantage:
It simple insect control, disease, fertilizer, etc. It helps in aid in environmental purification and job formation.It is also fast and easy, Funds are transferred extremely easily through one account to another. Minimal prices, quick customer developments, and competition in the industry. It saves them money in the medium-haul, less servicing.Disadvantage:
The drones are too expensive to use, so poor farmers can be cut off. Specialist technicians and gaining popularity are required. The financial services data can be distributed through many devices and therefore become more fragile. The personal contact loss, theft, security problems, etc. The higher operating costs, geographical limitations, and so on.Write a method named removeDuplicates that accepts a string parameter and returns a new string with all consecutive occurrences of the same character in the string replaced by a single occurrence of that character. For example, the call of removeDuplicates("bookkeeeeeper") should return "bokeper" .
Answer:
//Method definition
//Method receives a String argument and returns a String value
public static String removeDuplicates(String str){
//Create a new string to hold the unique characters
String newString = "";
//Create a loop to cycle through each of the characters in the
//original string.
for(int i=0; i<str.length(); i++){
// For each of the cycles, using the indexOf() method,
// check if the character at that position
// already exists in the new string.
if(newString.indexOf(str.charAt(i)) == -1){
//if it does not exist, add it to the new string
newString += str.charAt(i);
} //End of if statement
} //End of for statement
return newString; // return the new string
} //End of method definition
Sample Output:
removeDuplicates("bookkeeeeeper") => "bokeper"
Explanation:
The above code has been written in Java. It contains comments explaining every line of the code. Please go through the comments.
The actual lines of codes are written in bold-face to distinguish them from comments. The program has been re-written without comments as follows:
public static String removeDuplicates(String str){
String newString = "";
for(int i=0; i<str.length(); i++){
if(newString.indexOf(str.charAt(i)) == -1){
newString += str.charAt(i);
}
}
return newString;
}
From the sample output, when tested in a main application, a call to removeDuplicates("bookkeeeeeper") would return "bokeper"