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
BigorU [14]
3 years ago
11

Write a program name Dollars that calculates and displays the conversion of an entered number of dollars into currency denominat

ions---20s, 10s, 5s, and 1s.
Computers and Technology
1 answer:
Cloud [144]3 years ago
7 0

Answer:

I will code in Javascript.

Preconditions:

  • The variable dollar is passed by parameter to the function.

function Dollars(dollar) {

 

//declare and initialize the variables.

 var twenties = 0;

 var tens = 0;

 var fives = 0;

 var ones = 0;

 

<em>//If dollar is greater or equals 20, divide dollar by 20 and save it into the variable twenties. Then, save the remainder into the variable dollar.  </em>

 if(dollar >= 20){

   twenties = Math.floor(dollar/20);

   dollar = dollar % 20;

 }

<em>//If dollar is greater or equal 10, divide dollar by 10 and save it into the variable twenties. Then, save the remainder into the variable dollar.  </em>

 if(dollar>=10){

   tens = Math.floor(dollar/10);

   dollar = dollar % 10;

 }

<em>//If dollar is greater or equal 5, divide dollar by 5 and save it into the variable twenties. Then, save the remainder into the variable dollar.  </em>

 if(dollar>=5){

   fives = Math.floor(dollar/5);

   dollar = dollar % 5;

 }

<em> //If dollar is greater or equal 1, divide dollar by 1 and save it into the variable twenties. Then, save the remainder into the variable dollar.   </em>

 if(dollar>=1){

   ones = Math.floor(dollar/1);

   dollar = dollar % 1;

 }

//At this point, dollar is equal 0.It's time to display the conversion.

Console.log('20s :' + twenties);

Console.log('10s :' + tens);

Console.log('5s :' + fives);

Console.log('1s :' + ones);

}

Explanation:

The variable Math.floor(num) is used to round a number downward to its nearest integer.

For example, if dollar=57:

twenties = dollar/20 will be 57/20 = 2

dollar = dollar % 20 will be 57 % 20 = 17

tens = dollar/10 will be 17/10 = 1

dollar = dollar % 10 will be 17 % 10 = 7

fives = dollar/5 will be 7/5 = 1

dollar = dollar % 5 will be 7 % 5 = 2

ones = dollar/1 will be 2/1 = 2

dollar = dollar % 1 will be 0 % 5 = 0

You might be interested in
Provided you have an Internet connection and functional Web browser, gather information on three different commercial RAID contr
aalyn [17]

Answer:

1). Serial ATA (SATA): SATA drives are base hard drives. Serial ATA was designed to  replace the older parallel ATA (PATA) standard (often called by the old name IDE), offering several advantages  over the older interface: reduced cable size and cost (7 conductors instead of 40), native hot swapping, faster  data transfer through higher signaling rates, and more efficient transfer through a I/O queuing protocol. On  some systems without a controller, these can be cabled instead to the onboard SATA connections on the  motherboard. On smaller servers with a controller, they can still be cabled because these systems will not have  a backplane. Cabled hard drives are not hot swappable.

2). Near Line SAS: Near Line SAS are enterprise SATA drives with a SAS interface, head, media, and rotational  speed of traditional enterprise-class SATA drives with the fully capable SAS interface typical for classic SAS

drives. This provides better performance and reliability over SATA. Basically it is a hybrid between SATA and SAS.

3). Serial Attached SCSI (SAS): SAS is a communication protocol used in Enterprise hard drives and tape drives.  SAS is a point-to-point serial protocol that replaces the older based parallel SCSI bus technology (SCSI). It uses  the standard SCSI command set. These have extra connections through the top of the SATA connection. These  are the top end in performance for electromechanical drives.

4). Solid-State Drive (SSD): An SSD is a data storage device that uses integrated circuit assemblies as memory to  store data persistently. SSD technology uses electronic interfaces compatible with traditional block  input/output (I/O) hard disk drives. SSDs do not employ any moving mechanical components, which  distinguishes them from traditional magnetic disks such as hard disk drives, which are electromechanical  devices containing spinning disks and movable read/write heads. Compared with electromechanical disks, SSDs  are typically less susceptible to physical shock, are silent, and have lower access time and latency. Typically  because of these features, SSD drives can be the fastest I/O in the market today in standard hard drive form factor.

Explanation:

5 0
4 years ago
Which option helps you adjust column width to match the text?
torisob [31]
<span>auto-fit is the answer perhaps</span>
7 0
3 years ago
You are using a polynomial time 2-approximation algorithm to find a tour t for the metric traveling salesman problem. Which of t
Svet_ta [14]

Answer:

B. The cost of tour t is at most twice the cost of the optimal tour.

Explanation:

You are using a polynomial time 2-approximation algorithm to find a tour t for the traveling salesman problem.

The cost of tour t is at most twice the cost of the optimal tour

The equation represented as Cost(t) <= 2 Cost(T)

Where

Cost (t) represents cost of tour t

Cost(T) represents cost of the optimal tour

3 0
3 years ago
Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
guajiro [1.7K]

Answer:

With more than 722 million prospects on this platform, there’s a huge potential to find your next set of qualified leads.

  • More than 89% of the B2B marketers are already using LinkedIn to scale their lead generation efforts.
  • Almost 62% of them admit that LinkedIn has helped them to generate 2X more leads than any other social channels.
  • Almost 49% of the B2B marketers are using LinkedIn AI automation tools to find their future customers easily.
  • Also, more than half of the B2B buyers are on LinkedIn to make their buying decisions. This means that your ideal future leads are on LinkedIn making it a perfect platform for your business.  

That’s part of the reason why LinkedIn is one of the favorite platforms to generate B2B leads.

7 0
3 years ago
Volume of Pyramid = A*h/3 where A is the area of the base of the pyramid and h is the height of the pyramid. Write a C++ program
insens350 [35]

Answer:

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

   double side, height;

   

   cout<<"Enter the length of one of the sides of the base: ";

   cin>>side;

   cout<<"Enter the height: ";

   cin>>height;

   

   double area = side * side;

   double volume = area * height / 3;

   

   cout<<"The area of the base of the pyramid is: "<<area<<endl;

   cout<<"The height of the pyramid is: "<<height<<endl;

   cout<<"The volume of the pyramid is: "<<fixed<<setprecision(2)<<volume<<endl;

   return 0;

}

<u>Pseudocode:</u>

Declare side, height

Get side

Get height

Set area = side * side

Set volume = area * height / 3

Print area

Print height

Print volume

Explanation:

Include <iomanip> to have two decimal places

Declare the side and height

Ask the user to enter side and height

Calculate the base area, multiply side by side

Calculate the volume using the given formula

Print area, height and volume (use <em>fixed</em> and <em>setprecision(2)</em> to have two decimal places)

4 0
3 years ago
Other questions:
  • What is the numeric range of a 16-bit unsigned binary value?
    6·1 answer
  • Suppose that, in addition to edge capacities, a flow network has vertex capacities. That is each vertex vv has a limit l(v)l(v)
    7·1 answer
  • The difference between an AutoCorrect entry and a building block is that the building block feature makes corrections automatica
    6·1 answer
  • Given an alphanumeric string made up of digits and lower case ASCII characters only, find the sum of all the digit characters in
    14·1 answer
  • You want to establish the validity of a test designed for computer technicians using a predictive criterion-related validation s
    9·1 answer
  • Where are super computer mainly used​
    13·2 answers
  • Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total p
    13·1 answer
  • Peter’s Father wants to buy a new computer for his office use on word processing tasks. He wants to bring his computer to and fr
    8·2 answers
  • We cannot imagine a life without the Internet. Imagine that you had to live without being connected to the Internet. Discuss the
    13·1 answer
  • This was the template given for my assignment: class Login:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!