Write a program to read in two consumer price indexes and print out the inflation rate.
1. Start with the student starter code and follow the instructions in the code.
2. Instructions to complete are tagged in comments like the ones below. They will always begin with // TODO. // TODO #1: declare two float variables for the old consumer price index (cpi) and the new cpi // TODO #2: Read in two float values for the cpi and store them in the variables
// TODO #3: call the function InflationRate with the two cpis // TODO #4: print the results
3. Once you have this program working, submit for credit.
4. Advance to the next lab InflationRate Part2.

Answers

Answer 1

Answer:

Here is the C++ program:

#include<iostream>  //to use input output functions

#include<cmath>  //to use math functions

using namespace std;  //to identify objects cin cout

double InflationRate(float oldCPI,float newCPI);  //function prototype

int main() {  //start of main function

  float oldCPI,newCPI,rate;  //declares two float variables for the old and consumer price indices

  char choice;  //stores user choice to continue

  double sum=0.0;  // computes the sum of inflation rates

  int count = 0;  //to count the number of inflation rates computed

  double average = 0.0;  //to compute the average inflation rate

  do   {  //this loop continues to execute and ask user to enter cpis

  cout << "Enter the old and new consumer price indices: ";  //prompts user to enter new and old cpi

  cin>>oldCPI>>newCPI;  // Read in two float values for the cpi

  rate = InflationRate(oldCPI,newCPI);  //call the function InflationRate with the two cpis

  cout << "Inflation rate is: "<< rate<< endl;  //displays the result

  sum = sum + rate;  //computes sum of inflation rates

  count++;  //counts number of computed inflation rates

  cout<<"Try again? (Y or y): ";  //prompts if user wants to continue

  cin>>choice;  //reads choice of user y or Y

  }while((choice=='Y')||(choice=='y'));  //the loop continues to repeat as long as user enters small or capital y

  average = sum/count;  //computes the average inflation rate

  cout<<"Average rate is: "<<average;}  //displays the average inflation rate

   

double InflationRate(float oldCPI,float newCPI){  // function that takes two arguments oldCPI and new CPI and computes the inflation rate

   return (newCPI - oldCPI) / oldCPI * 100;} //formula to compute inflation rate

Explanation:

1.        

/*This program computes the inflation rate using two consumer price indexes. It takes as parameters, the previous price index and current price index and computes inflation rate by the formula:

(newCPI- oldCPI) / oldCPI and multiply the result by 100 */

#include <iostream>  //to use input output functions

using namespace std;   //to identify objects cin cout

2.

float oldCPI, newCPI; //declare two float variables for old and new consumer price index

cout << "Enter the old and new consumer price indices: ";  //prompts user to enter values for old and new cpi

cin>>oldCPI>>newCPI; //read in two float values for the cpi and store them in the variables oldCPI and newCPI

double result = InflationRate(oldCPI,newCPI); //call the function InflationRate with the two cpis

cout << "Inflation rate is:  " << result<< endl; //prints the result

3. and 4.

The complete program is given in the Answer section

For example if user enters 238.343 as old cpi and 238.250 as new cpi then the program works as follows:

oldCPI =238.343

newCPI = 238.250

Now the function InflationRate is called by passing these two parameter and this function returns :

   return (newCPI - oldCPI) / oldCPI * 100;}

this becomes

(newCPI - oldCPI) / oldCPI * 100

(238.250 - 238.343) / 238.343  * 100

-0.093/238.343  * 100

- 0.00039 * 100

= -0.039 0204

Hence

result = -0.039 0204

Next, sum = sum + rate; statement computes the sum as:

sum = 0.0 + (-0.039 0204)

sum = -0.039 0204

count++ increases the count by 1

count = 1

Next user is asked if he/she wants to continues. If user presses y or Y then user is asked again to enter values for new and old cpi. Suppose user enters the following values:  

oldCPI =238.250

newCPI = 237.852

Now the function InflationRate is called by passing these two parameter and this function returns :

   return (237.852- 238.250) / 238.250* 100;}

this becomes

(newCPI - oldCPI) / oldCPI * 100

(237.852- 238.250) / 238.250* 100

−0.398/238.250* 100

- 0.001670491 * 100

= -0.167049

Hence

result = -0.167049

Next, sum = sum + rate; statement computes the sum as:

sum =  -0.039 0204 + (-0.167049)

sum = -0.206069

count++ increases the count by 1

count = 2

Now lets say the user enters n or any other key when asked if user wants to continue. So the loop breaks and program moves to the statement:

average = sum/count;

This becomes:

average = -0.206069/2

average = −0.103034

Hence

Average rate is: −0.103034

Write A Program To Read In Two Consumer Price Indexes And Print Out The Inflation Rate. 1. Start With

Related Questions

what are the uses of joystick​

Answers

Joysticks are often used to control video games, and usually have one or more push-buttons whose state can also be read by the computer. A popular variation of the joystick used on modern video game consoles is the analog stick.

Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating value ZZZ. Store each String in one of two lists—one list for short Strings that are 10 characters or fewer and another list for long Strings that are 11 characters or more. After data entry is complete, prompt the user to enter which type of String to display, and then output the correct list. For this exercise, you can assume that if the user does not request the list of short strings, the user wants the list of long strings. If a requested list has no Strings, output The list is empty. Prompt the user continuously until a sentinel value, ZZZ, is entered.

Answers

Answer:

count = 20

i = 0

short_strings = []

long_strings = []

while(i<count):

   s = input("Enter a string: ")

   

   if s == "ZZZ":

       break

   

   if len(s) <= 10:

       short_strings.append(s)

   elif len(s) >= 11:

       long_strings.append(s)

   

   i += 1

choice = input("Enter the type of list to display [short/long] ")

if choice == "short":

   if len(short_strings) == 0:

       print("The list is empty.")

   else:

       print(short_strings)

else:

   if len(long_strings) == 0:

       print("The list is empty.")

   else:

       print(long_strings)

Explanation:

*The code is in Python.

Initialize the count, i, short_strings, and long_strings

Create a while loop that iterates 20 times.

Inside the loop:

Ask the user to enter a string. If the string is "ZZZ", stop the loop. If the length of the string is smaller than or equal to 10, add it to the short_strings. If the length of the string is greater than or equal to 11, add it to the long_strings. Increment the value of i by 1.

When the loop is done:

Ask the user to enter the list type to display.

If the user enters "short", print the short list. Otherwise, print the long_strings. Also, if the length of the  chosen string is equal to 0, print that the list is empty.

Write a program that will input the names, ages and weights of three siblings and display the lightest followed by the youngest of the siblings. Do the above assignment without using an array of objects. Implementation Create a project asSibling. In the above project, create a class Sibling not containing the main method. In the above project, create a class TestSibling containing the main method.

Answers

Answer:

Here is the JAVA program:

Sibling.java class:

import java.util.Scanner;  //to accept input from user

public class Sibling {  //class name

//private data members of class

   private String name;  // String type variable to hold the name of sibling

   private int age;  // int type variable to hold the age of sibling

   private int weight;  // int type variable to hold the weight of sibling

   public Sibling() {}     //constructor of class Sibling

   public Sibling (String n, int a, int w)  {  //parameterized constructor

       name = n;  // refers to name field

       age = a;  // refers to age field

       weight = w;    }   // refers to weight field

   public String getName ()    {   //accessor method to get the current name of sibling

       return name;    }   //returns the name field of the sibling

   public int getAge ()    {   //accessor method to get the current age of sibling

       return age;    }   //returns the age field of the sibling

   public int getWeight (){ //accessor method to get the current weight of sibling

    return weight;    } //returns the weight field of the sibling

   public void getInput() {    //to take input name,age and weight from user

 Scanner input = new Scanner(System.in);  //Scanner class object

 System.out.print("Enter the name:  ");  //prompts user to enter the name of sibling

 name = input.nextLine();  //scans and reads the input name from user

 System.out.print("Enter the age:  ");  //prompts user to enter the age of sibling

 age = input.nextInt();   //scans and reads the age from user

 System.out.print("Enter the weight:  ");  //prompts user to enter the weight of sibling

 weight = input.nextInt(); } }   //scans and reads the input weight from user

Explanation:

Here is the TestSibling class that contains main method:

public class TestSibling {   //class name

public static void main (String[] args) {   //main method

String name;  // to hold name of sibling

int age, weight;   // to hold age and weight of sibling

Sibling sib1, sib2, sib3;   // objects of Sibling class

sib1 = new Sibling ();  // creates object of class Sibling for sibling 1 and calls constructor

sib1.getInput();   // calls getInput method using sib1 object to get the name, age and weight of sibling 1

sib2 = new Sibling ();  // creates object of class Sibling for sibling 2 and calls constructor

sib2.getInput();   //calls getInput method using sib2 object to get the name, age and weight of sibling 2

sib3 = new Sibling ();  //creates object of class Sibling for sibling 3 and calls constructor

sib3.getInput();   //calls getInput method using sib3 object to get the name, age and weight of sibling 3

Sibling youngest=null, lightest=null;    //holds the youngest age and lightest weight of siblings

if (sib1.getAge( )<= sib2.getAge( ) && sib1.getAge( ) <= sib3.getAge( ) )   /*if condition checks if age of sibling 1 is less than or equals to that of sibling 2 and sibling 3,  using object of each sibling and getAge method to access age. the logical operator && AND is used so that if condition evaluates to true if sib1 is younger than both sib2 and sib3 */

{ youngest=sib1;}   //if the above condition is true then sets sib1 as youngest

else if (sib2.getAge( ) <= sib1.getAge( ) && sib2.getAge( ) <= sib3.getAge( ) )   // else if condition checks if age of sibling 2 is less than or equals to that of sibling 1 and sibling 3

{youngest=sib2;}   // if above condition is true then sets sib2 as the youngest

else   //if none of the above condition is true then this means that the third has the lowest age

{            youngest=sib3;    }    //sets sib3 as the youngest

if (sib1.getWeight( ) <= sib2.getWeight( ) && sib1.getWeight( ) <= sib3.getWeight( ) )   //if condition checks if weight of sibling 1 is less than or equals to that of sibling 2 and sibling 3,  using object of each sibling and getAge method to access weight of each sibling

          { lightest=sib1; }   //if the above condition is true then sets sib1 as having the lightest weight

else if (sib2.getWeight( ) <= sib1.getWeight( ) && sib2.getWeight( ) <= sib3.getWeight( ) )  // else if condition checks if weight of sibling 2 is less than or equals to that of sibling 1 and sibling 3

{lightest=sib2; }  //if the above condition is true then sets sib2 as the lightest

else  //if none of the above condition is true then this means that the third has the lightest weight

{ lightest=sib3;   }  //sets sib3 as the lightest

System.out.println("The lightest sibling: " + lightest.getName() +" " + lightest.getAge()+" "+ lightest.getWeight());  } } //calls the getName() getAge() and getWeight() method using object lightest to print the lightest of the siblings

System.out.println("The youngest sibling: " + youngest.getName() +" " + youngest.getAge()+" "+ youngest.getWeight());  //calls the getName() getAge() and getWeight() method using object youngest to print the youngest of the siblings

The screenshot of the output is attached.

An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of oneand-one-half times that. From the worker’s gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. For a harder version, write your program so that it allows the calculation to be repeated as often as the user wishes. If this is a class exercise, ask your instructor whether you should do this harder version.

Answers

Answer:

Here is the C++ program:

#include<iostream>  // to use input output functions

using namespace std;  //to access objects cin cout

int main() {  //start of main function

int hrsWorked;  //stores the number of hours worked

   int dependents;  //stores the number of dependents

double grossPay;  //stores the gross pay

char choice;  //store the value for choice of user to continue

do {  //loop that keeps repeating as often as the user wishes

  cout<<"Enter number of hours worked in a week: ";  // prompts user to enter number of weeks

  cin>>hrsWorked;  //reads input value for number of hours worked

  cout<<"Enter number of dependents : "; // prompts user to enter number of dependents

  cin>>dependents;  //reads input value for number of dependents  

      if(hrsWorked>40)  //if hours worked are more than 40

       {grossPay = ((40 * 16.78) + (hrsWorked-40)*(16.78*1.5));  }  //employee is paid at the overtime rate of one and-one-half times

       else  //if hours worked are not more than 40

      { grossPay = (hrsWorked*16.78);}  // employee is paid at a rate of $16.78 per hour        

      double ssTax = 0.06* grossPay ;  //computes 6% Social Security tax withheld from gross pay

      double fIncomeTax = 0.14* grossPay;  //computes 14% federal income tax withheld from gross pay

      double sIncomeTax = 0.05 * grossPay;  //computes 5% state income tax withheld from gross pay      

   cout<<"worker’s pay: "<<grossPay<<endl;  //displays workers pay

   cout<<"worker’s gross pay after withholding amounts:"<<endl;  //displays workers pay including withholding amounts

   cout<<"withhold amount for state income tax is: "<<sIncomeTax<<endl;  //displays grosspay with state income tax withheld

   cout<<"withhold amount for social security tax is: "<<ssTax<<endl;  //displays grosspay with Social Security tax withheld

   cout<<"withhold amount for federal income tax is: "<<fIncomeTax<<endl;  //displays grosspay with federeal income tax withheld

   cout<<"withhold amount  for union dues is: $10 "<<endl;   // $10 per week is withheld for union dues

if(dependents >= 3) {  //if worker has three or more dependents

cout<<"withhold amount of $35 for health insurance "<<endl;

  grossPay = grossPay - 35;  }  //an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays  

    cout<<endl;  //prints a new line

    double take_homepay;  //stores the net take-home pay for the week.

    take_homepay = ((grossPay- ssTax- sIncomeTax - fIncomeTax) - 10);  //compute the net t ake-home pay for the week

cout<<"net amount take-home pay for the week is: "<<take_homepay;  //displays the net take-home pay for the week

    cout<<endl;  //prints a new line

cout<<"\nDo you want to continue? (press y to repeat or any key to quit)";  //ask user to repeat the calculation

cin>>choice;  //reads choice from user

cout<<endl;  //prints a new line

}while(choice =='y' || choice =='Y');  }   //loop continues to execute till user wants to repeat calculations and stops when user presses any key other than y or Y

Explanation:

The program works as follows:

Suppose number of working hours is 40 and number of dependents is 2

hrsWorked = 40

dependents = 2

if(hrsWorked>40) this condition evaluates to false because hrsWorked is equal to 40 so else part executes:

grossPay = (hrsWorked*16.78); this becomes:

grossPay = 40 * 16.78

grossPay = 671.2

double ssTax = 0.06* grossPay ;  this statement withholds 6% Social Security tax from gross pay. This becomes:

ssTax = 0.06* 671.2;

ssTax = 40.272

double fIncomeTax = 0.14* grossPay;  this statement withholds 14% federal income tax from gross pay. This becomes:

fIncomeTax = 0.14* 671.2;

fIncomeTax = 93.968

double sIncomeTax = 0.05 * grossPay;  this statement withholds 5% state income tax from gross pay. This becomes:

sIncomeTax = 0.05 * 671.2

sIncomeTax = 33.56

if(dependents >= 3) this condition is false because number of dependents is 2

Next to compute  net take-home pay the program control moves to the statement:

take_homepay = ((grossPay- ssTax- sIncomeTax - fIncomeTax) - 10)

this becomes:

take_homepay = ((671.2 - 40.272 - 33.56 - 93.968) - 10)

Note that the 10 here is the $10 per week which is withheld for union dues.

take_homepay = ((671.2 - 40.272 - 33.56 - 93.968) - 10)

take_homepay = 503.4 - 10

take_homepay = 493.4

The screenshot of the output of this program is attached.

What is the primary purpose of a namespace?

Answers

Answer:

A namespace ensures that all of a given set of objects have unique names so that they can be easily identified.

Explanation:

Answer:

A namespace ensures that all of a given set of objects have unique names so that they can be easily identified.

Explanation:

What is the most likely designation for an engineer in charge of a company's equipment and machinery? a. design engineer b. inspection engineer c. technical sales engineer d. maintenance engineer​

Answers

Answer: Maintenance engineer

Explanation:

Design engineer is an engineer that uses both mathematical and scientific methods to develop ideas that will be used and design that'll be used for a particular product.

Inspection engineers are the engineers that checks out roads, bridges etc and identify problems that such structures have so as to prevent accidents from happening.

Technical sales engineer advices the company and also give support with regards to products when technical expertise may be required.

Maintenance engineers are the engineers that are involved in checking, and servicing equipments and machinery and making sure that they're always functioning properly and in good, working conditions. These engineers ensures the smooth running of machines.

Based on the above scenario, the answer is maintenance engineers.

Answer:

d

Explanation:

(The Location class) Design a class named Location for locating a maximal value and its location in a two-dimensional array. The class contains public data fields row, column, and maxValue that store the maximal value and its indices in a two dimensional array with row and column as int type and maxValue as double type.Write the following method that returns the location of the largest element in a two-dimensional array.public static int[] locateLargest(double[][] a)The return value is a one-dimensional array that contains two elements. These two elements indicate the row and column indices of the largest element in the two dimensional array. Write a test program that prompts the user to enter a two-dimensional array and displays the location of the largest element in the array. Here is a sample run:Enter the number of rows and columns of the array: 3 4Enter the array:23.5 35 2 104.5 3 45 3.535 44 5.5 9.6The location of the largest element is at (1, 2)

Answers

Answer:

Here is the Location class:

public class Location {   //class name

   public int row;  // public data field to hold the value of no. of rows

   public int column;  // public data field to hold the value of no. of columns

   public double maxValue;   //public data field to hold the maximum value

   public Location(int row, int column, double maxValue) { //parameterized constructor of Location class

//this keyword is used to refer to a current instance variable and used to avoid naming conflicts between attributes and parameters with the same name

       this.row = row;  

       this.column = column;  

       this.maxValue = maxValue;     }  

   public static Location locateLargest(double[][] a) {   //method that takes a 2 dimensional array a as argument and returns the location of the largest element

       int row = 0;  //initializes row to 0

       int column = 0;  //initializes column to 0

       double maxValue = a[row][column];   //stores largest element

       for (int i = 0; i < a.length; i++) {  //iterates through rows of a[] array

           for (int j = 0; j < a[i].length; j++) {  //iterates through columns of array

               if (maxValue < a[i][j]) {  //if the maxValue is less than the element of 2 dimensional array at ith row and jth column

                   maxValue = a[i][j];  //then set that element to maxValue

                   row = i;  // i is set to traverse through rows

                   column = j;   }             }         }  // i is set to move through columns

       return new Location(row,column,maxValue);     }  } //calls constructor of class by passing row, column and maxValue as argument

Explanation:

Here is the Main class with a main() function to  test program  

import java.util.Scanner;   //to accept input from user

public class Main {   //class name

   public static void main(String[] args) {   //start of main function

       Scanner scan = new Scanner(System.in);  //creates Scanner class object to scan the input from user

 System.out.print("Enter the number of rows and columns in the array: ");  //prompt for user

       int row = scan.nextInt();  // reads value of row from user

       int column = scan.nextInt();  //reads input value of column

       double[][] array = new double[row][column];   //declares a 2 dimensional array named array

       System.out.println("Enter the array:");  //prompts to enter array elements

       for (int i = 0; i < array.length; i++) {  //iterates through the rows of array until the size of array is reaced

           for (int j = 0; j < array[i].length; j++) {  //iterates through the columns of array

               array[i][j] = scan.nextDouble();    }    }   //reads each element at i-th row and j-th column

       Location location = Location.locateLargest(array);  //calls locateLargest method by passing array to it in order to locate the largest element in the array

System.out.println("The largest element in a two-dimensional array is: " + location.maxValue);  //displays the largest element of array

       System.out.println("The location of the largest element is at (" + location.row + ", " + location.column + ")");       }    } //displays the location of the largest element in the two dimensional array

Suppose the user enters 2 rows and 2 columns. The elements are:

1         5.5

4.5      3

The program works as follows:

for (int i = 0; i < array.length; i++) this outer loop iterates through rows

i = 0

inner loop for (int j = 0; j < array[i].length; j++) iterates through columns

array[i][j] = scan.nextDouble(); reads the element at position i-th row and j-th column. This becomes:

array[0][0] = scan.nextDouble();

so element at 0th row and 0th column is 1

Location location = Location.locateLargest(array); now this calls the method which works as follows:

double maxValue = a[row][column]; this becomes:

double maxValue = a[0][0];

so maxValue = 1

for (int i = 0; i < a.length; i++) this loop in method iterates through rows and  for (int j = 0; j < a[i].length; j++) this iterates through columns of array

if (maxValue < a[i][j]) this becomes:

if (maxValue < a[0][0])

As we know that maxValue = 1 so this if condition is true.

                   maxValue = a[i][j];  this becomes:

             maxValue = a[0][0];  

maxValue = 1

Now set row = 0 and column = 0

Now the inner loop value of j is incremented to 1. So j = 1

At next iteration array[0][1] is checked. The element at this position is 5.5

if (maxValue < a[i][j]) is true because 1<5.5 so now value of maxValue becomes:

maxValue = 5.5

and

i = 0  j = 1

This way at each iteration of inner loop the columns are traversed and at each iteration of outer loop rows are traversed.

At next iteration element at array[1][0] is checked which is 4.5. This is not greater than maxValue so maxValue remains 5.5

At next iteration element at array[1][1] is checked which is 3. This is not greater than maxValue so maxValue remains 5.5 .

After both the loops end the statement:

return new Location(row,column,maxValue);

returns row , column and maxValue

where row = 0  column = 1 and maxValue = 5.5

So the output is:

The largest element in a two-dimensional array is: 5.5

The location of the largest element is at (0,1)

In this exercise we have to write a JAVA code requested in the statement, like this:

find the code in the attached image

We can write the code in a simple way like this below:

import java.util.Scanner;

public class Main {  

  public static void main(String[] args) {  

      Scanner scan = new Scanner(System.in);

System.out.print("Enter the number of rows and columns in the array: ");  

      int row = scan.nextInt();

      int column = scan.nextInt();

      double[][] array = new double[row][column];  

      System.out.println("Enter the array:");  

      for (int i = 0; i < array.length; i++) {

          for (int j = 0; j < array[i].length; j++) {  

              array[i][j] = scan.nextDouble();    }    }  

      Location location = Location.locateLargest(array);  

System.out.println("The largest element in a two-dimensional array is: " + location.maxValue);  

      System.out.println("The location of the largest element is at (" + location.row + ", " + location.column + ")");       }    }

See more about JAVA at brainly.com/question/2266606

Create a program that will read in a Salesperson name, employment status (1=Full-time AND 2=Part-time) and the sales amount.
In the Output, display the salesperson name along with the commission amount earned. The commission rate for full-time is 4% while for part-time is 2%.
Lastly, your program must also display the text “You have exceeded the sales quota!” if the following conditions are met:
Full-time and sales is over 1000
Part-time and sales is over 500
Use the Console for the Input and Output.

Answers

Answer:

Written using Python

name = input("Name: ")

print("1 for Full time and 2 for Part time")

status = int(input("Status: "))

sales = float(input("Sales Amount: "))

if status == 1:

     commission = 0.04 * sales

else if status == 2:

     commission = 0.02 * sales

print(name)

print(commission)

if status == 1 and sales>1000:

     print("You have exceeded the sales quota!")

if status == 2 and sales>500:

     print("You have exceeded the sales quota!")

Explanation:

I've added the full source code as an attachment where I used comments to explain some lines

Write a function named replaceSubstring. The function should accept three string object arguments entered by the user. We want to look at the first string, and every time we say the second string, we want to replace it with the third. For example, suppose the three arguments have the following values: 1: "the dog jumped over the fence" 2: "the" 3: "that" With these three arguments, the function would return a string object with the value "that dog jumped over that fence". Demonstrate the function in a complete program. That means you have to write the main that uses this.

Answers

Answer:

public class Main{

public static void main(String[] args) {

 System.out.println(replaceSubstring("the dog jumped over the fence", "the", "that"));

}

public static String replaceSubstring(String s1, String s2, String s3){

    return s1.replace(s2, s3);

}

}

Explanation:

*The code is in Java.

Create function called replaceSubstring that takes three parameters s1, s2, and s3

Use the replace function to replace the s2 with s3 in s1, then return the new string

In the main:

Call the replaceSubstring function with the given strings and print the result

Using math functions Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of (x minus y), and the square root of (x to the power of z). Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3, your_value4)) Ex: If the input is: 5.0 1.5 3.2
the output is: 172.47 340002948455826440449068892160.00 6.50 262.43

Answers

Answer:

import math

x = float(input())

y = float(input())

z = float(input())

value1 = pow(x, z)

value2 = pow(x, pow(y, z))

value3 = abs(x - y)

value4 =  math.sqrt(pow(x, z))

print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(value1, value2, value3, value4))

Explanation:

*The code is in Python.

Ask the user to enter x, y, and z as floating point numbers

Calculate the each expression using math functions, pow - calculates the power, abs - calculates the absolute value, and sqrt - calculates the square root

Print the values in required format

Note that the given output is not correct. It must be:

172.47 361.66 3.50 13.13

You need to buy a cable to connect a desktop PC to a router. Which cable should
you get?
Choose the answer.
Cat6 crossover
Cat5e crossover
Cat3 patch
Cat6 patch

Answers

Answer:

Cat 6 patch

Explanation:

Crossover cables are used for connecting NIC cards together - not for connection to a router or switch.

Cat 3 is an older standard with limited speeds (up to 10MB per second).

Cat 6 is the current standard with speeds up to 10GB per second.

In which of these places might you be most likely to find a peer-to-peer network? *

In a large office building
On the Internet
In a home
In a hospital

Answers

Answer:

(b) On the Internet

Explanation:

Peer-to-Peer or P2P network is a networking technology that allows several network devices to share resources and exchange resources and directly communicate with each other.

In P2P network , all the computers and devices are part of the network are called as peer.

Peer-to-Peer is used to share processing power, network bandwidth or disk storage space. But most common use of peer-to-peer is sharing of files on internet.

Answer:

in a home is the correct answer

What is the default layout position for images added to a Word 2016 document?

A) square, where the text wraps around an image around a square border
B) through, where the text wraps around an image with irregular borders
C) in front of the text, where the image is placed over the text
D) in-line, with the text where the text stays with the image

Answers

Answer:

D

Explanation:

Hope it works

Answer:

D) in-line, with the text where the text stays with the image

Explanation:

Just did it in ED.

Question 1 Multiple Choice Worth 5 points)
(03.01 MC)
Cheri needs to write a small program that interacts with the user. What step will allow her to do this?
Assigning a value to a variable
Giving step-by-step directions
Including an input statement
Incorporating engaging content

Answers

Answer:

c

Explanation:

Answer:

c

Explanation:

took the test

Select the correct answer.
Which decimal number is equivalent to this binary number?
001100112
A.
15
OB.
51
OC.
204
D.
240

Answers

The answer is B , 51.

In which situation would saving a Word document as a PDF be most useful?

Answers

It can be useful in many ways, from saving it for something important for work to a test for school. I usually use it for my classwork and tests.

Hope this helped if it did may i have brainliest?

Answer:

when users who want to view a document do not have Word

Explanation:

edge 2021

Dividing a hard drive into multiple sections is known as partitioning

Answers

Answer:

Partitioning

Explanation:

Classifying a hard drive into multiple sections is called as Partitioning.Here each regions can be managed separately.Partitioning allows the use of different file systems to be installed for different kinds of files.Partitioning can also make back up easier

Good afternoon guys !!!

For all those Computer science smart people i am calling you !!!

i need you to answer this question asap and as best as you can

BE creative

thank you so much

With your partner, think of a new app idea. What inputs does it need? What outputs? What types of processing does it use to change the input to output?




App idea



Inputs



Outputs



Types of processing



How processing turns helps turn input to output

Answers

Answer:

your answer is

outputs

Assignment 2: Room area

Answers

Answer:

a = float(input("Enter Side A: "))

b = float(input("Enter Side B: "))

c = float(input("Enter Side C: "))

d = float(input("Enter Side D: "))

e = float(input("Enter Side E: "))

area1 = 1.0* a * b

area2 = (a - c) * (d - e -b)

area3 = 0.5 * (a - c) * e

print ("Room Area: " + str(area1 + area2 + area3))

Explanation:

happy to help ^3^

Answer:

a = float(input("Enter side A: "))

b = float(input("Enter side B: "))

c = float(input("Enter side C: "))

d = float(input("Enter side D: "))

e = float(input("Enter side E: "))

area1 = (b)*(c)

area2 = (d-e)*(a-c)

area3 = (0.5)*(a-c) *(e)

print("Room Area: " + str(area1 + area2 + area3))

Explanation:

i got a 100, i hope it helps

What is the default file extension for all Word documents?

Question 8 options:

.txts


.word


.docs


.docx

Answers

Answer:

The correct answer is docx

.docx is the answer

Which of the following could NOT be represented by a boolean variable?

Whether a moving elevator is moving up or down

Whether a traffic light is green, yellow or red

Whether a store is open or closed

Whether a light-bulb is on or off

Answers

Answer:

Whether a traffic light is green, yellow or red

Explanation:

Boolean variables are variables that can either take one out of two options at any given instance.

Analyzing the given options

1. Elevator:

Possible Directions = Up or Down; That's two possible values

But it can only move in one direction at a given instance.

This can be represented using Boolean

2. Traffic Light:

Possible Lights = Green, Yellow or Red

That's three options.

This can be represented using Boolean

The last two options can be represented using Boolean because they have just two possible values

Hence, option (B) answers the question

Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (current_price * 0.051) / 12.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))
Ex: If the input is:
200000
210000
the output is:
This house is $200000. The change is $-10000 since last month.
The estimated monthly mortgage is $850.00.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming.
main.py
current_price = int(input())
last_months_price = int(input())
''' Type your code here. '''

Answers

Answer:

current_price = int(input())

last_months_price = int(input())

change = current_price - last_months_price

mortgage = (current_price * 0.051) / 12

print('This house is $' + str(current_price) + '. The change is $' + str(change) + ' since last month.')

print('The estimated monthly mortgage is ${:.2f}.'.format(mortgage))

Explanation:

Ask the user to enter the current price and last month's price

Calculate the change, subtract last month's price from the current price

Calculate the mortgage using the given formula

Print the results in required format

#include using namespace std; int main( ) { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]; int i = 0; int j = 0; int maxMiles = -99; // Assign with first element in milesTracker before loop int minMiles = -99; // Assign with first element in milesTracker before loop milesTracker[0][0] = -10; milesTracker[0][1] = 20; milesTracker[1][0] = 30; milesTracker[1][1] = 40;

Answers

Answer:

#include <iostream>

using namespace std;

int main()

{

   const int NUM_ROWS = 2;

   const int NUM_COLS = 2;

   int milesTracker[NUM_ROWS][NUM_COLS];

   int i = 0;

   int j = 0;

   int maxMiles = -99; // Assign with first element in milesTracker before loop

   int minMiles = -99; // Assign with first element in milesTracker before loop

   milesTracker[0][0] = -10;

   milesTracker[0][1] = 20;

   milesTracker[1][0] = 30;

   milesTracker[1][1] = 40;

   

   maxMiles = milesTracker[0][0];

   minMiles = milesTracker[0][0];

   

   for (i = 0; i < NUM_ROWS; i++){

       for (j = 0; j < NUM_COLS; j++){

           if (milesTracker[i][j] > maxMiles){

               maxMiles = milesTracker[i][j];

           }

           if (milesTracker[i][j] < minMiles){

               minMiles = milesTracker[i][j];

           }

       }

   }

   

   cout << "Min: " << minMiles << endl;

   cout << "Max: " << maxMiles << endl;

   return 0;

}

Explanation:

It seems you want to find the min and max value in the array. Let me go through what I added to your code.

Set the maxMiles and minMiles as the first element in milesTracker

Create a nested for loop that iterates through the milesTracker. Inside the loop, check if an element is greater than maxMiles, set it as maxMiles. If an element is smaller than minMiles, set it as minMiles.

When the loop is done, print the minMiles and maxMiles

Which connection device enables you to access outside networks such as the
Internet? Choose the answer.
switch
router
network adapter
hub

Answers

Router
Your router controls everything the IP address the gataway all that
Router because without it you wouldnt be able to connect to the internet

Question 4 (Multiple Choice Worth 5 points)
(03.04 MC)
Which function will add a name to a list of baseball players in Python?

A append()
B main
C print()
D sort(

Answers

Answer:

A. append()

Explanation:

I don't know python fully but i do know what stuff means

Print: display text

Main: basically the roots of the entire code

Sort: it's in the freaking name

so crossing out 3 of the 4 its safe to assume its append.

Answer:

A) The function that will add a name to a list of base ball players in python is append.

Explanation:

Which of the following option may be used to change page size and margins?

Question 7 options:

Data


Tools


View


Page setup

Answers

Answer: D ) page set up

Explanation:

Answer:

Page Set up

Explanation:

"Change page size and margins"

I don't think I have to explain that.

(5 points) Create a user-defined data structure (i.e., struct) called Point that represents a two-dimensional Cartesian coordinate (x, y). The member variables of this struct will be just x and y, which are both floating-point values. (5 points) Define a function called calculateDistance that takes two parameters, each of type Point* (i.e., pointer to Point) and returns the distance between the two given points. As you may recall, the formula for calculating the distance between two points, say p1(x1, y1) and p2(x2, y2) is:

Answers

Answer:

Here is the C++ program:

#include<iostream>  //to use input output functions

#include <math.h>  //to use sqrt and pow function

#include<iomanip>  //to use setprecision

using namespace std;   //to identify objects cin cout

struct Point  {  // structure name

float x,y;  // member variables

};  

float calculateDistance (Point a, Point b)  {  //function that that takes two parameters of type Point

float distance;  //stores the distance between two points

distance=sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));  //formula to compute distance between two points

return distance;  }  //returns the computed distance

int main()  {  //start of main function

Point p1,p2;  //creates objects of Point

cout<<"Enter point 1 coordinates: "<<endl;  //prompts user to enter the value for coordinates of first point

cin>>p1.x;  //reads input value of x coordinate of point 1 (p1)

cin>>p1.y;  //reads y coordinate of point 1 (p1)

cout<<"Enter point 2 coordinates: "<<endl;  //prompts user to enter the value for coordinates of second point

cin>>p2.x;  //reads input value of x coordinate of point 2 (p2)

cin>>p2.y;  //reads y coordinate of point 2 (p2)

cout<<"The distance between two points is "<<fixed<<setprecision(2)<<calculateDistance(p1,p2);} //calls function by passing p1 and p2 to compute the distance between p1 and p2 and display the result (distance) up to 2 decimal places

Explanation:

The program has a structure named Point that represents a two-dimensional Cartesian coordinate (x, y). The member variables of this struct are x and y, which are both floating-point values. A function called calculateDistance takes two parameters, a and b of type Pointer and returns the distance between the two given points using formula:

[tex]\sqrt{(x_{2}-x_{1} )^{2} +(y_{2}-y_{1} )^{2} }[/tex]

It uses pow function to compute the power of 2 and sqrt function to compute the square root.

Then in main() method the program prompts the user to enter coordinates for two points and calls calculateDistance method to compute the distance between two points and display the result up to 2 decimal places using setprecision(2).

The program along with the output is attached in a screenshot.

No Loops, or if statements, or arrays allowed for this program. You will receive a zero if your program contains any loop, if statement, or array. You need a program to maintain information about your stocks. Assume that you have the following stocks:
Stock Name Number of Shares Buying Price Current Price Yearly Fees
Per Share Per Share
IBM 155 $15.33 $13.33 $5.00
ORACLE 375 $11.77 $12.25 $3.50
SUN MICRO 350 $27.55 $35.75 $12.25
LINKSYS 85 $25.35 $23.34 $6.00
CISCO 50 $45.36 $50.86 $1.50
You must use the data from this table for you Program Set 2 submission.
Write a C program that will perform the following tasks:
Task 1: Allow the user to enter in the data for each stock. Stock name, Number of shares, Buy Price, Current Price and Yearly fees.(The user will not enter the $'s.)
Task 2: Calculate the Initial Cost, Current Cost, and Profit for each stock. The formulas to use are: Initial Cost

Answers

Answer:

Here is the C program:

#include <stdio.h> //to use input output functions

int main(){ //start of main function

    char *stock_name=NULL; //to store stock name (this is used instead of using char type array)

    int shares; //to store number of shares

    float buy_price; //to store the buy price

    float cur_price; //to store the current price

    float fees; //to store the fees

    double initial_cost; //to store the computed initial cost

    double current_cost; //to store the value of computed current cost

    double profit; //to store the calculated value of profit

printf("enter stock name ");  //prompts to enter stock name

scanf("%m[^\n]",&stock_name); //reads the input stock name

printf("enter number of shares "); //prompts to enter number of shares

scanf("%d", &shares); //reads the input number of shares

printf("enter the buy price, current price and fees "); //prompts to enter buy price, current price and fees values from user

scanf("%f %f %f", &buy_price, &cur_price, &fees); //reads the values of buy price, current price and fees from user

    initial_cost = shares * buy_price; //computes initial cost

    current_cost = shares *cur_price; //computes current cost

    profit = current_cost - initial_cost - fees; //computes profit for each stock

printf("The stock name is: %s\t\n",stock_name); //displays the stock name

printf("The number of shares: \t%d\t\t\n",shares); //displays the number of shares

printf("The buy price is:\t$\t %0.2f\t\n",buy_price); //displays the buy price

printf("The current price is:\t$\t %0.2f\n",cur_price); //displays the current price

printf("The fees are:\t\t$\t %0.2f\n",fees); //displays the fees

printf("The initial cost is:\t$\t %0.2f\n",initial_cost); //displays the computed initial cost

printf("The current cost is:\t$\t %0.2f\n",current_cost); //displays the computed current cost

printf("The profit is:\t\t$\t %0.2f\n",profit);//displays the computed profit for each stock

return 0;  }

       

Explanation:

Lets say the user input IBM, 150, 11.33 13.33 and 5.00 as stock name, number of shares, buy price, current price and fees values.

So,

stock_name = "IBM"

shares = 150

buy_price = 11.33

cur_price = 13.33

fees = 5.00

Now initial cost is computed as:

  initial_cost = shares * buy_price;

This becomes:

  initial_cost = 150* 11.33

  initial_cost = 1699.5

Next current cost is computed as:

    current_cost = shares *cur_price;

This becomes:

    current_cost = 150*13.33

    current_cost = 1999.5

Next the profit is computed as:

    profit = current_cost - initial_cost - fees;

This becomes:

    profit = 1999.5 - 1699.5 - 5.00

     profit =     295

These values are displayed on the output screen up to 2 decimal places. So the output of the entire program is:

The stock name is: IBM                                                                                                                        The number of shares:   150                                                                                                                   The buy price is:         $        11.33                                                                                                        The current price is:   $        13.33                                                                                                        The fees are:               $        5.00                                                                                                         The initial cost is:        $        1699.50                                                                                                      The current cost is:     $        1999.50                                                                                                      The profit is:                 $        295.00

The screenshot of the output is attached.

Which elements of photography does the Iso rating apply

Answers

Answer:its sensitivity to light if it has a lower iso it probably would need more alumination or a longer shuter speed.

Explanation:

Answer:

the film or the sensor

Explanation:

Arrange the following units of storage in descending
order. B, TB,KB, GB,MB

Answers

Answer:

TB,GB,MB,KB,B

Explanation:

Other Questions
At Grocery Mart, strawberries cost $2.98 for 2 lb. What is the unit rate Amy wants to adjust her camera settings so that it automatically sets the apertures and shutter speeds while still allowing her to control the ISO and flash settings. Which mode dial option should Amy choose to achieve this?A. manual modeB. aperture priority modeC. program modeD. shutter priority mode Im a bit stuck on this question can I use a little help? Which of the following is an example of employee advocacy?A. Asking a manager to hire the relative of an employeeB. Negotiating with management for fair pay and benefitsc. Offering personal advice to an employee about a family matter how do the dancer move while dancing a quadratic equation that has a discriminant of -10 When a bumper car changes direction, does that mean there must be a net force acting on it? Explain, using the word accelerates in your answer. In below freezing conditions, keep your fuel level at least _________ full to keep moisture from freezing in your gas line. Where do the US and Canada rank worldwide in land size? Is table salt a mixture ?True False HELP PLEASE ITS EASY What kind of weather system encourages a thunderstorms to develop Select all that apply: Tonicity of a solution Check All That Apply is related to solute content.is related to solute content. is related to the pH of the solution.is related to the pH of the solution. gives information about potential changes in cell volume when cells are placed in that solution.gives information about potential changes in cell volume when cells are placed in that solution. is closely related to the temperature of the solution.is closely related to the temperature of the solution. is related to membrane permeability to solutes. Cabeza de vaca served all of the following except ____ while he was in Texas A.slave B.Translator C.Trader D.Doctor a square tarp has an area of 64 square feet what is the length of one side of the tarp If the parabola of the form y = a( h)^2 + k is always shifted horizontally h units and vertically k uniits vertex is alwaYs if a train travels 420 miles in 24 hours, what is its unit rate of travel 4^2z/3=8(z+2) how do you solve this equation anyone ? The Magna Carta was presented to King John in 1215 because people Owere tired of his tyrannical rule. Owanted him to declare war on France. wanted to praise him for his good deeds. were afraid he was too vweak a ruler. Why did Georgias early settlers establish their towns near water?