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
A mobile device you are troubleshooting is experiencing a sharp decrease in performance after an hour of operation. The user pow
Finger [1]

Answer: Close or disable all unused running apps.

Explanation: when unused apps keep runningon the device, it will make the device to keep lagging, thereby reducing it efficiency. But once those apps are disabled or closed and the system is probably restarted, the device will regain it efficiency back.

8 0
3 years ago
Need help with my cs110​
lord [1]
Yes so the it’s C 283 cause I think yes can
7 0
3 years ago
What is one way for an entrepreneur to decrease risk?
marysya [2.9K]

Answer

we can  decrease risk for an entrepreneur by creating a team of trusted advisors to rely on.

there are some points that we can take in mind know how  to position our company as a safe position.

revenue streams and additional technology, paving the way for future growth.

Entrepreneurs can use all these  unique strategies to decrease those risk

8 0
3 years ago
What is the problem with paying only your minimum credit card balance each month​
Vinvika [58]

Answer:

The problem is that each month your credit card balance increases, and it increase by a certain percent of what you already owe. So if you pay the minimum each month, you'll just end up paying more money because it's ever increasing.

Please give brainliest!

6 0
3 years ago
Read 2 more answers
Write the pseudo-code of an algorithm that returns the sum of all integers in a list of integers. You may use the Pascal-like ps
Arlecino [84]

Answer:

//variable integer_list to hold a list of integers

DECLARE integer_list

ASSIGN values to integer_list

//variable sum to hold the sum of the elements in the list

DECLARE sum

ASSIGN zero to sum

//loop through the integer_list and sum all it's elements together.

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

sum += interger_list.get(i)

}

//Show the result of the addition from the for loop

DISPLAY "The sum is " + sum

Explanation:

The above code uses some hypothetical programming language syntax. The second and third lines declare an arbitrary integer list and assign a set of values to it respectively.  

The fifth line declares a variable "sum" which will hold the result of summing all the elements in the list. The sixth line initializes "sum" to zero.

The for loop shown iterates through the integer list cumulatively summing its elements.

The result is displayed as written on line 12.

Hope it helps!  

3 0
4 years ago
Other questions:
  • Write the header for a function addOne that accepts a single integer reference parameter and returns nothing. Name the parameter
    5·1 answer
  • How can an administrator force wireless clients to use a standard web browser to provide information, and require a user to agre
    10·1 answer
  • Write a function called median, that takes as parameter a full, sorted array of doubles and returns the median of the list. For
    15·1 answer
  • Write the reverseO function recursively. This function takes a string and the length of the string as arguments and returns the
    15·2 answers
  • What does a shutter speed of one mean?
    14·2 answers
  • Which of the following about Java arrays is true?
    14·1 answer
  • Select the correct answer.
    9·1 answer
  • What is word processing program,Give 3 types of word processing program​
    9·1 answer
  • State two differences between a mouse pointer and a mouse cursor​
    10·2 answers
  • A(n) Blank______ database model stores data in the form of logically related two-dimensional tables. Multiple choice question. w
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!