1answer.
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
asambeis [7]
3 years ago
14

Create a program that compares the unit prices for two sizes of laundry detergent sold at a grocery store.

Computers and Technology
1 answer:
astraxan [27]3 years ago
4 0

Complete Question:

Create a program that compares the unit prices for two sizes of laundry detergent sold at a grocery store. Console Price Comparison Price of 64 oz size: 5.99 Price of 32 oz size: 3.50 Price per oz (64 oz): 0.09 Price per oz (32 oz): 0.11

Using Python

Answer:

<em>This program does not make use of comments (See explanation section)</em>

price64 = float(input("Price of 64 oz size: "))

price32 = float(input("Price of 32 oz size: "))

unit64 = price64/64

unit32 = price32/32

print("Unit price of 64 oz size: ", round(unit64,2))

print("Unit price of 32 oz size: ", round(unit32,2))

if unit64>unit32:

     print("Unit price of 64 oz is greater" )

else:

     print("Unit price of 32 oz is greater" )

Explanation:

This line prompts the user for the price of 64 oz size

price64 = float(input("Price of 64 oz size: "))

This line prompts the user for the price of 32 oz size

price32 = float(input("Price of 32 oz size: "))

This line calculates the unit price of 64 oz size

unit64 = price64/64

This line calculates the unit price of 32 oz size

unit32 = price32/32

This next two lines print the unit prices of both sizes

print("Unit price of 64 oz size: ", round(unit64,2))

print("Unit price of 32 oz size: ", round(unit32,2))

The next line compares the unit prices of both sizes

if unit64>unit32:

This line is executed if the unit price of 64 oz is greater than 32 oz

     print("Unit price of 64 oz is greater" )

else:

This line is executed, if otherwise

     print("Unit price of 32 oz is greater" )

You might be interested in
Programming: Write a recursive function to_number that forms the integer sum of all digit characters in a string. For example, t
scZoUnD [109]

yes

Explanation:

isn't really noted but if the sequence is in the given order the ("3at4") could be expressed in a ('0' to '9' )format

7 0
3 years ago
Which of the following statements is false? a. Classes (and their objects) encapsulate, i.e., encase, their attributes and metho
prohojiy [21]

Answer:

The correct option is C: For objects to communicate effectively with one another, each must know how the other object is implemented.

Explanation:

For effective communication of objects with each other, there is no need for each object to know how the other object is implemented. The rules for communication are already defined, and hence you do not have to know, as details of implementation are hidden. Hence the only false statement from the options is C.

5 0
3 years ago
Write a program that gets a list of integers from input, and outputs the integers in ascending order (lowest to highest). The fi
kozerog [31]

Answer:

see explaination

Explanation:

#include <iostream>

#include <vector>

using namespace std;

void vector_sort(vector<int> &vec) {

int i, j, temp;

for (i = 0; i < vec.size(); ++i) {

for (j = 0; j < vec.size() - 1; ++j) {

if (vec[j] > vec[j + 1]) {

temp = vec[j];

vec[j] = vec[j + 1];

vec[j + 1] = temp;

}

}

}

}

int main() {

int size, n;

vector<int> v;

cin >> size;

for (int i = 0; i < size; ++i) {

cin >> n;

v.push_back(n);

}

vector_sort(v);

for (int i = 0; i < size; ++i) {

cout << v[i] << " ";

}

cout << endl;

return 0;

}

7 0
3 years ago
Digital data is _____ and analog information is _____.
Liula [17]
Digital data is discrete and analog information is continuous.
6 0
4 years ago
What is your opinion about Sophia, just a robot or human robot (explain your answer<br> with merits
Ray Of Light [21]
Who’s Sophia and pls give more context
3 0
3 years ago
Read 2 more answers
Other questions:
  • Identifying Characters
    11·2 answers
  • What command would you use to make a secure shell connection to the ubuntu client machine? ()?
    9·1 answer
  • The list below represents the contents of a computer's main memory. I've left every other byte blank. Assume that the letters at
    14·1 answer
  • Write the function lettersOnly(s) that takes in a string called s, and returns a string containing only the alphabetic character
    8·1 answer
  • List out any five input and output devideos​
    5·1 answer
  • Mga halimbawa ng migrasyon​
    13·1 answer
  • Need help with Python coding...
    8·1 answer
  • How to fix this? Zoom it in to see it better
    8·1 answer
  • Explain connectivity is productivity
    14·1 answer
  • Radio spectrum is the part of the complete range of electromagnetic waves that is used for radio communication from
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!