answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
docker41 [41]
1 year ago
14

Write a program trapezoid.cpp that prints an upside-down trapezoid of given width and height. However, if the input height is im

possibly large for the given width, then the program should report,
Computers and Technology
1 answer:
MatroZZZ [7]1 year ago
3 0

Answer:

#include <iostream>

using namespace std;

int main()

{    

   int rows, width, height, spaces, stars; // declare values

   cout << "enter width" << endl;

   cin >> width;

   cout << "enter height" << endl;

   cin >> height;

   for (int row = 0; row < height; ++row) {

       for (int col = height + row; col > 0; --col) {

           if (height % 6 == 1) {  

               cout << "Impossible shape!" << endl;

               return 0;

           }

           cout << " ";

       }

       for (int col = 0; col < (width - 2 * row); ++col) {

           cout << "*";

           spaces += 1;

           stars -= 2;

       }

       cout << endl;

You might be interested in
E xercise 17.2.4: The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt;
masya89 [10]

Answer:

Check the explanation

Explanation:

The following is a sequence of Undo — log records written by two transactions.

<START 1>; <F, A, 10>; <START U>; <U, B, 20>; <F, C, 30>; <U, D, 40>; <COMMIT U>; <T, E, 50>; <COMMIT T>; (a) < START U >;

If the system crashes after the log < START U >,

Then we have log records will be shown below.

<START U>;

<T, A, 10>;

<START T>;

SYSTEM CRASHED

The recovery manager sees the Undo - Redo log and inspect the both trans-actions T and U are not committed. Then those elements changed by both transactions are arranged to their old values.

  1. Transaction T changes the element A.
  2. Then the Element A is arranged to old value A=10.
  3. Transaction U did not change any existing element in the records.
  4. So, not anything to do with transaction U.

(B) < T, E, 50>;

If the system crashes after the log < T, E, 50>;

Then we have log records will be shown below .

START T>;

<T, A, 10>;

<START U>;

<U, B, 20>;

<T, C, 30>;

<U, D, 40>;

<COMMIT U>;

<T, E, 50>;

SYSTEM CRASHED

The recovery manager sees the Redo logs and inspect the transaction U is committed or not. Such changes made by transaction U are reached to disk.

• So much the recovery manager arranged the elements to their recent values changed by transaction U.

• Transaction U changed the elements B and its records <U, B, 20>with re-cent values.

• Transaction U changed the elements D and its records <U, D, 40>with recent values.

• The transaction T is not committed.

• Then the elements changed by transaction T are arranged to old values.

• Then element A is arranged to 10, C is arranged to 30 and E is arranged to 50.

7 0
2 years ago
Let's assume that the smallest possible message is 64 bytes (including the 33-byte overhead). if we use 100base-t, how long (in
Ostrovityanka [42]

As we know that 10-bAse data travels at the rate of 10 mbps, therefore at 1 sec we have 10240 bytes.

We have to calculate for 64 bytes travelling in one second. Multiply both sides by 64.

64 sec = 10240 x 64 bytes

64 bytes = 64 / 10240 sec

Now we have to calculate for light of speed

1 sec = 186000 miles

Substitute this value to the formula above

64 bytes = 64 / 10240 x 1 sec = 64 / 10240 x 186000 miles = 64 / 10240 x 186000 x 5280 feet = 6138x10^3 feet

Therefore, 64 bytes is equal to 6138 x 10^3 feet long message

3 0
1 year ago
JAVA Write a program that first asks the user to type a letter grade and then translates the letter grade into a number grade. L
ale4655 [162]

Answer:

Follows are the code to this question:

import java.util.*;//import package for user input

class GradePrinter//defining class GradePrinter

{

double numericValue = 0;//defining double variable

String grade = "";//defining String variable

GradePrinter()//defining default constructor  

{

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

System.out.print("Enter Grade: ");//print message

grade = xb.nextLine();//input string value  

}

double getNumericGrade()//defining double method getNumericGrade

{

if (grade.equals("A+") || grade.equals("A"))//defining if block that check input is A+ or A

{

numericValue = 4.0;//using  numericValue variable that hold float value 4.0

}

else if (grade.equals("A-"))//defining else if that check grade equals to A-

{

numericValue = 3.7;//using  numericValue variable that hold float value 3.7

}

else if (grade.equals("B+"))//defining else if that check grade equals to B-

{

numericValue = 3.3;//using  numericValue variable that hold float value 3.3

}

else if (grade.equals("B"))//defining else if that check grade equals to B

{

numericValue = 3.0;//using  numericValue variable that hold float value 3.0

}

else if (grade.equals("B-"))//defining else if that check grade equals to B-  

{

numericValue = 2.7;//using  numericValue variable that hold float value 2.7

}

else if (grade.equals("C+"))//defining else if that check grade equals to C+  

{

numericValue = 2.3; //using  numericValue variable that hold float value 2.3

}

else if (grade.equals("C")) //defining else if that check grade equals to C  

{

numericValue = 2.0; //using numericValue variable that hold float value 2.0

}

else if (grade.equals("C-")) //defining else if that check grade equals to C-  

{

numericValue = 1.7;//using umericValue variable that hold float value 1.7

}

else if (grade.equals("D+"))//defining else if that check grade equals to D+  

{

numericValue = 1.3;//using umericValue variable that hold float value 1.3

}

else if (grade.equals("D"))//defining else if that check grade equals to D

{

numericValue = 1.0;//using umericValue variable that hold float value 1.0

}

else if (grade.equals("F"))//defining else if that check grade equals to F

{

numericValue = 0;//using umericValue variable that hold value 0

}

else//defining else block

{

System.out.println("Letter not in grading system");//print message

}

return numericValue;//return numericValue

}

}

class Main//defining a class main

{

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

{

GradePrinter ob = new GradePrinter();// creating class GradePrinter object

double numericGrade = ob.getNumericGrade();//defining double variable numericGrade that holds method Value

System.out.println("Numeric Value: "+numericGrade); //print Value numericgrade.

}

}

Output:

Enter Grade: B

Numeric Value: 3.0

Explanation:

In the above-given code, a class "GradePrinter" is defined inside the class a string, and double variable "grade and numericValue" is defined, in which the grade variable is used for input string value from the user end.

After input, the sting value a method getNumericGrade is defined, which uses multiple conditional statements is used, which holds double value in the which is defined in the question.

In the main class, the "GradePrinter" object is created and defines a double variable "numericGrade", that calling method and store its value, and also use print method to print its value.

4 0
1 year ago
Mechanical advantage is the ratio of the force required to move a load divided by______
Veseljchak [2.6K]
I am not sure but i think it is 2 or 4 because a pc can withstand the power of volts, drive, ram, and data
3 0
2 years ago
A government agency is getting rid of older workstations. The agency will donate these workstations, along with other excess com
Basile [38]

Answer:

The answer is "Using the DoD 5220.22-M method and  Degauss media with a magnet".

Explanation:

The "DoD Standard" is a term used during the data sanitizing industry and refers to DoD 5220.22-M. The simplest ways are being used to help eliminate the previously stored data, by deleting hard disc storage facilities with the same data wherever that used a sequence of all zeros.

The sparging eliminates statistics to entirely delete the gravitational flux from electronic media. Hard drives as well as other data storage devices, for example, computer tapes, retain magnetic data. It could no longer be seen as storage after a disk is degaussed.

6 0
1 year ago
Other questions:
  • _________ is a term used to describe the process of recording movement of an object and translating it into a digital format..
    8·2 answers
  • Refer to the exhibit. pc1 issues an arp request because it needs to send a packet to pc3. in this scenario, what will happen nex
    9·1 answer
  • Write a copy constructor for carcounter that assigns origcarcounter.carcount to the constructed object's carcount. sample output
    15·2 answers
  • Write a program in c or c++ to perform different arithmeticoperation using switch statement .the program will take two inputinte
    10·1 answer
  • Thomas has signed a deal with a production house that allows them to use his images on their website. What is required when imag
    5·2 answers
  • Consider the relation Courses(C, T, H, R, S, G), whose attributes can be thought of informally as course (C), teacher (T), hour
    10·1 answer
  • Represent the logic of a program that allows the user to enter a value for one edge of a cube. The program calculates the surfac
    10·1 answer
  • Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to beco
    15·1 answer
  • You have an on-premises network that contains several servers. You plan to migrate all the servers to Azure. You need to recomme
    14·1 answer
  • The web development team is having difficulty connecting by ssh to your local web server, and you notice the proper rule is miss
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!