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
fomenos
3 years ago
8

Assume that price is an integer variable whose value is the price (in US currency) in cents of an item. Write a statement that p

rints the value of price in the form "X dollars and Y cents". So, if the value of price was 4321, your code would print "43 dollars and 21 cents". If the value was 501 it would print "5 dollars and 1 cents". If the value was 99 your code would print "0 dollars and 99 cents".
Computers and Technology
1 answer:
aivan3 [116]3 years ago
3 0

Answer:

// here is program in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variable

int price;

cout<<"enter the price: ";

// read the price

cin>>price;

// find the dollars

int doll=price/100;

// find the cents

int cent=price%100;

// print the dollars and cents

cout<<doll<<" dollars and "<<cent<<" cents.";

return 0;

}

Explanation:

Read the price from user and assign it to variable "price".Then find the dollars by dividing the price with 100 and to find cents calculate modulus 100 of price. Then print both the value.

Output:

enter the price: 4321                                                                                                      

43 dollars and 21 cents.

You might be interested in
The tools, skills, knowledge, and machines created and used by humans is known as.
miskamm [114]

Answer:

Human capital

Explanation:

It means the economic value of workers experience and skills

7 0
2 years ago
Fred opens a web browser and connects to the www.certskills.com website. Which of the following are typically true about what ha
Masja [62]

Answer:

c. Messages flowing to the client typically use a source TCP port number of 80.

d. Messages flowing to the server typically use TCP.

Explanation:

When fred open the web browser and start a connection to the www.certskills.com website.Two things happens from the mentioned things

1.Messages that are going to the server are use TCP(Transmission Control Protocol).

2.Message goes to the client uses port number 80 that is of TCP used for transferring web pages.

Because the port number 80 is reserved for the HTTP used for transferring web pages that uses TCP protocol.

4 0
4 years ago
Type the correct answer in the box. Spell all words correctly.
Kamila [148]

Answer:emphasis

Explanation:

7 0
3 years ago
Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/kmâ
zvonat [6]

Answer:

class Car(object):

   fuel = 0

   def __init__(self, mpg):

       self.mpg = mpg

   def drive(self, mile):

       if self.fuel * self.mpg >= mile:

           self.fuel -= mile / self.mpg

       else:

           print(f"get gas for your {self}")

       print(f"Fuel remaining: {self.fuel}")

   #classmethod

   def get_gas(cls):

       cls.fuel += 50

   #classmethod

   def add_gas(cls, gallon):

       if cls.fuel + gallon > 50:

           cls.fuel += 10

       else:

           cls.fuel += gallon

gulf = Car(20)

gulf.get_gas()

gulf.drive(200)

Explanation:

The Car class is defined in Python. Its drive method simulates the driving of a car with fuel that reduces by the miles covered, with efficiency in miles per gallon. The get_gas and add_gas methods fill and top up the car tank respectively.

3 0
2 years ago
Light travels at 3 × 108 meters per second. A light-year is the distance a light beam travels in one year.Write a PYTHON program
Volgvan

Answer: This is a python code

def lightyear():

   rate=3*100000000   //speed of light

   seconds=365*24*60*60   //number of seconds in 1 year

   return str((rate*seconds)/1000)+" km"    //distance=speed x time

print(lightyear()) //will print value of light hear in kilometers

OUTPUT :

9460800000000.0 km

Explanation:

In the above code, there is a variable rate, which stores the speed of light, i.e. distance traveled by light in 1 second which is in meters. Another variable is seconds, which store the number of seconds in 1 year, which is no of days in 1 year multiplied by the number of hours in a day multiplied by the number of minutes in an hour multiplied by the number of seconds in a minute. Finally, distance is speed multiplied by time, so distance is printed in kilometers and to convert distance in kilometers it is divided by 1000.

4 0
3 years ago
Other questions:
  • Which loan type requires you to make loan payments while you’re attending school?
    10·1 answer
  • Problem 5. (Greatest Common Divisor) Write a program gcd.py that accepts p (int) and q (int) as command-line arguments, and writ
    13·1 answer
  • What is the output?<br> &gt;&gt;&gt; phrase = "hello mom"<br> &gt;&gt;&gt; phrase upper()
    6·2 answers
  • Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correc
    9·2 answers
  • Compare and contrast Charles bebbage and Blaise Pascal inventions<br>​
    14·1 answer
  • Hy plzz help me friends​
    5·2 answers
  • What happen if there is no authentication??
    10·2 answers
  • Whats the difference between Input and Output? Give and example of an example on a M:B​
    15·1 answer
  • Explain why this scenario could put an organization in jeopardy of losing some of its workforce.
    12·1 answer
  • I recorded a video on my windows PC, but when i tried to play it i got this message:
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!