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
malfutka [58]
3 years ago
6

The following pseudocode describes how to extract the dollars and cents from a price given as a floating-point value. For exampl

e, a price 2.95 yields values 2 and 95 for the dollars and cents.
a. Assign the price to an integer variable dollars.
b. Multiply the difference price - dollars by 100 and add 0.5.
c. Assign the result to an integer variable cents. Translate this pseudocode into a Java program. Read a price and print the dollars and cents. Test your program with inputs 2.95 and 4.35.
Computers and Technology
1 answer:
castortr0y [4]3 years ago
4 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 

 double price;

 int dollars, cents;

 

 System.out.print("Enter price: ");

 price = input.nextDouble();

 

 dollars = (int) price;

 cents = (int) (((price - dollars) * 100) + 0.5);

 

 System.out.println("Dollars: " + dollars + ", " + "Cents: " + cents);

}

}

Explanation:

Ask the user to enter price

Typecast the price as int and set it to the dollars

Subtract dollars from price, multiply the difference by 100, add 0.5 to the multiplication and type cast the result as int

Print the dollars and cents

You might be interested in
When making decisions, it is important to remember that ______.
Makovka662 [10]

Answer:

I think it's no choice is perfect but I don't know.

Explanation:

Definitely not the last one, because making decisions doesn't mean you're the boss lol.

4 0
3 years ago
Read 2 more answers
Write a C# program that prints the number of quarters, dimes, nickels, and pennies that a customer should get back as change. De
kondor19780726 [428]

Following are the code of C# to prints the number of quarters, dimes, nickels, and pennies

Program Explanation:

  • Declaration of the namespace.
  • Made a class named "Class1".
  • Declared the methods as well as the attributes.
  • Declared the main method.
  • Wrote the statements according to the given query.

Program:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Project1

{

   class Class1      

   {

       static void Main(string[] args)

       {

           int change = 0;

           int quart, dim, nic, pen;

           Console.WriteLine("enter amount of cents (less than 99)");

           change = int.Parse(Console.ReadLine());

           quart = change / 25; //calculate the remainder              

           int p = change % 25;

           dim = (p / 10);

           int a = p % 10;

           // Nickles

           nic = a / 5;

           int c = a % 5;

           pen = c;

           Console.Write("There are {0} quarters.\n", quart);

           Console.Write("There are {0} dimes.\n", dim);

           Console.Write("There are {0} nickels.\n", nic);

           Console.Write("There are {0} pennies.\n", pen);

           Console.ReadLine();

       }

   }

}

Output:

Please find the attachment of the output.

Learn more about C# here:

brainly.com/question/5023004

6 0
3 years ago
What is difference between computer and smartphone
tiny-mole [99]

Answer: One is smaller than the other.

4 0
3 years ago
Open punctuation means that no punctuation follows the salutation or complimentary close. *
zloy xaker [14]

Answer:

True

Explanation:

When open punctuation is used, we do not expect the use of punctuation after salutation or complimentary close. It is a relatively new concept in business writing and we can rightly use this method in modified block letter style of writing.  

Some companies have developed business letter templates that are arranged in an open style, which permits the use of open punctuation in all aspect of business writings.  

7 0
3 years ago
Which term was used to define the era of the Internet, when the web became a "platform" for user-generated input, as opposed to
Pachacha [2.7K]

Hello, The answer to your question is:-

<em><u>Option </u></em><em><u>"</u></em><em><u>Web </u></em><em><u>2</u></em><em><u>.</u></em><em><u>0</u></em><em><u>"</u></em>

<em><u>Reference and proof</u></em>:-

Web 2.0 refers to websites that emphasize <u>user-generated content</u>, ease of use, participatory culture and interoperability (i.e., compatible with other products, systems, and devices) for end users.

Hope it helps you...

Answered by Benjemin ☺️

✅

5 0
3 years ago
Other questions:
  • Can someone text me cuss I'm bored my number is (225) 975 7120
    10·1 answer
  • Samuel is working on decimal and binary conversion for his college project.He is using the binary number 111011 and wants to exp
    8·1 answer
  • Assume v is a vector of integers that has been declared and initialized. Write a statement that adds the value 42 to the vector.
    14·1 answer
  • Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the follow
    9·1 answer
  • Please write a complete program to calculate monthly payment given
    15·1 answer
  • An international package shipping company like FedEx needs to be able to track the location of every package at every stage in t
    9·2 answers
  • What tab on the ribbon do I go into to create new database objects in Access?
    13·1 answer
  • The Hydrosphere contains (4 points)
    10·1 answer
  • The Quick Access tool bar allows you to customize the actions or commands you frequently use.
    13·1 answer
  • Please help with my Python code - Functions
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!