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
sdas [7]
4 years ago
6

Suppose you find a magic $1.00 coin. Its magic power is as follows: as each day passes, you get an additional dollar plus half o

f what you already had (it appears by the window somehow).
Write a method called getRichQuick (no input is necessary for this method) that prints the first n days while your total is less than $1,000,000 dollars. In other words, how many days does it take for you to earn $1,000,000?
Your program should calculate these numbers and print the following output:
Day 1: $1
Day 2: $1 + ($1 + .50) = $2.50
Day 3: $2.50 + ($1 + 1.25) = $4.75
...
Day N: $X + ($1 + Y) ≥ $1000000
Computers and Technology
1 answer:
AfilCa [17]4 years ago
7 0

Answer:

See explaination

Explanation:

public class QuickRich {

static void getRichQuick() {

double amount = 1;

int day = 1;

System.out.println("Day 1: $1");

while (amount < 1000000) {

day++;

if(amount + 1 + (amount/2) < 1000000)

System.out.printf("Day %d: $%.2f + ($1 + %.2f) = $%.2f\n", day, amount, amount/2, amount+(amount/2)+1);

else

System.out.printf("Day %d: $%.2f + ($1 + %.2f) >= $1000000\n", day, amount, amount/2);

amount += (1 + (amount/2));

}

}

public static void main(String[] args) {

getRichQuick();

}

}

You might be interested in
If i'm wanting to use hydra on linux to crack a password and the issue regarding hashes occurs, what shall i do?
Inessa05 [86]
Give up do research and then try again
7 0
4 years ago
A man receives a fraudulent email from his bank asking him to confirm his user name and password by going to a particular websit
bonufazy [111]

Answer: The man's info has been found and a hacker was trying to make him confirm his passwrd so he can get a hold of it to hack the man further.

Explanation:

3 0
3 years ago
A _______ is the most commonly used input device.
nirvana33 [79]
The answer is B.Keyboard
4 0
3 years ago
Read 2 more answers
Why a management-focused program provides a more appropriate learning path for you than a program based heavily on technical con
AlekseyPX
The program makes more money
3 0
4 years ago
The use of technology to observe a user's actions often without the user's knowledge is known as:
Margaret [11]

Answer:

C

Explanation:

Computer surveillance refers to spying that allows the viewer to gain access of all activity on the given computer.

5 0
3 years ago
Other questions:
  • Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output tho
    9·1 answer
  • If a ≤m b and b is regular, does that imply that a is a regular language? why or why not?
    6·1 answer
  • Which of the following is NOT a type of technology user? Digital Collaborator Media Mover Desktop Veteran Drifting Surfer Inform
    6·1 answer
  • What does limited access to a document mean? A. It makes a document inaccessible without a password. B. It enables a person to m
    7·1 answer
  • _____ is a technique in which computers are designed with many microprocessors that work together, simultaneously, to solve prob
    15·1 answer
  • Why is it so important to have employees who can critically think?
    7·2 answers
  • Which device do engineers use to drive a system of gears?
    15·2 answers
  • Which computer language uses short words known as mnemonics for writing programs?
    14·1 answer
  • Give me reasons why Harry Potter is bad and anime is better
    5·1 answer
  • All character entities end with _____ to signal the browser that everything in between is an entity representing a symbol.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!