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
xenn [34]
2 years ago
12

Write a program to help you feed your friends at a party by doing some math about square pizzas. Assume the grader defines a str

ing inputStr for you, which is a decimal string meaning the side length L of the pizza in cm. The area of the pizza should be computed using the formula A = L*L. Then, assuming that each person needs to eat 100 cm2 of pizza, compute the number of people it can feed, rounded down to the nearest integer
Computers and Technology
1 answer:
Nina [5.8K]2 years ago
3 0

Answer:

Following are the program in the Python Programming Language.

#get input from the user length of the pizza

inputStr = input('Enter the length of pizza: ')

#convert input into float

L = float(inputStr)

#initialize the area of the pizza

A = L*L

#calculate the amount of peoples can eat pizza

men = int(A/100)

#print the number of peoples

print('\nPizza can be eaten by {} people'.format(men))

<u>Output</u>:

Enter the length of pizza: 20

Pizza can be eaten by 4 people

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, set a variable that get length input from the user.
  • Set variable 'L' that convert the input from the user into the float data type.
  • Set variable 'A' that stores the area of the pizza.
  • Set variable 'men' that store the amount of peoples can eat pizza.
  • Finally, print the number of peoples can eat pizza.
You might be interested in
1.2.2: Output variable value. Jump to level 1 Write a statement that outputs variable userAge. End with a newline. 1 2 3 4 5 6 7
serg [7]

Answer:

cout<<"User Age is ="<<userAge<<endl;

Explanation:

#include<iostream>

using namespace std;

int main()

{

int userAge;

cin >> userAge; // Program will be tested with values: 15, 40.

cout<<"User Age is ="<<userAge<<endl;

return 0;

}

5 0
2 years ago
how do you make a circuit so 1 switch will turn on/off all the lights(3 lights) and a second switch will change the lights from
expeople1 [14]

Parallel circuit. On a wire you put the lights and one switch, on the other you put a resistor and another switch. (and the third wire contains the generator)
7 0
1 year ago
Read 2 more answers
You are consulting for a trucking company that does a large amount ofbusiness shipping packages between New York and Boston. The
likoan [24]

Answer:

Answer explained with detail below

Explanation:

Consider the solution given by the greedy algorithm as a sequence of packages, here represented by indexes: 1, 2, 3, ... n. Each package i has a weight, w_i, and an assigned truck t_i. { t_i } is a non-decreasing sequence (as the k'th truck is sent out before anything is placed on the k+1'th truck). If t_n = m, that means our solution takes m trucks to send out the n packages.

If the greedy solution is non-optimal, then there exists another solution { t'_i }, with the same constraints, s.t. t'_n = m' < t_n = m.

Consider the optimal solution that matches the greedy solution as long as possible, so \for all i < k, t_i = t'_i, and t_k != t'_k.

t_k != t'_k => Either

1) t_k = 1 + t'_k

    i.e. the greedy solution switched trucks before the optimal solution.

    But the greedy solution only switches trucks when the current truck is full. Since t_i = t'_i i < k, the contents of the current truck after adding the k - 1'th package are identical for the greedy and the optimal solutions.

    So, if the greedy solution switched trucks, that means that the truck couldn't fit the k'th package, so the optimal solution must switch trucks as well.

    So this situation cannot arise.

  2) t'_k = 1 + t_k

     i.e. the optimal solution switches trucks before the greedy solution.

     Construct the sequence { t"_i } s.t.

       t"_i = t_i, i <= k

       t"_k = t'_i, i > k

     This is the same as the optimal solution, except package k has been moved from truck t'_k to truck (t'_k - 1). Truck t'_k cannot be overpacked, since it has one less packages than it did in the optimal solution, and truck (t'_k - 1)

     cannot be overpacked, since it has no more packages than it did in the greedy solution.

     So { t"_i } must be a valid solution. If k = n, then we may have decreased the number of trucks required, which is a contradiction of the optimality of { t'_i }. Otherwise, we did not increase the number of trucks, so we created an optimal solution that matches { t_i } longer than { t'_i } does, which is a contradiction of the definition of { t'_i }.

   So the greedy solution must be optimal.

6 0
2 years ago
Using information from the lesson, explain how new technologies change your experience as a consumer.
densk [106]

Technological improvements allow me to have greater access to goods around the world. I can buy instantly and communicate instantly with producers. Technology can also help me to monitor economic trends, both in my country and in my own life. In summary, technology helps to give me more freedom to make economic choices.

On e2020

6 0
2 years ago
Read 2 more answers
At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase
inn [45]

Answer:

#include <iostream>

using namespace std;

 

int main () {

  // for loop execution

  int semester_fees=8000;

  int b=1;

  cout<<"there are 5 years or 10 semester fees breakdown is given below"<<endl;

  for( int a = 1; a <=5; a++ ) {

     semester_fees = semester_fees*1.03;

     cout<<"Semester fees for each of semester"<<b++<<"and"<<b++<<"is:$"<<semester_fees<<endl;

     

  }

 

  return 0;

}

Explanation:

code is in c++ language

Fees is incremented yearly and i have considered only two semester per year

3 0
1 year ago
Other questions:
  • If you want to present slides to fellow students or coworkers which productivity software should you use to create them A. Word
    14·2 answers
  • When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being
    11·2 answers
  • ______ is a statistic that measures how quickly the staff corrected a network problem after they arrived at the problem site. MT
    9·1 answer
  • Carrie works on a help desk and is assigned a ticket that was automatically generated by a server because of an error. The error
    5·1 answer
  • Does the Boolean expression count &gt; 0 and total / count &gt; 0 contain a potential error? If so, what is it?
    8·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    15·1 answer
  • JAVAThe method longestStreak is intended to determine the longest substring of consecutive identical characters in the parameter
    7·1 answer
  • Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out t
    9·1 answer
  • A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (1) Ou
    15·1 answer
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!