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
(70 points) This is a legit question that I have for a device FOR my homework.
guapka [62]

Answer:

it might be locked down so hold down the button for 20 sec and do a hard shut down, if it doesn't cut on try holding it down for down for 30 secs.  . IF that doesn't work there should be a port next to the power button. you can connect a micro-b cable to the kindle and then connect it to a computer or laptop if you have one.  There is a video where it shows you how to take it apart and repair if none of this helps

Explanation:  i hope this helps

7 0
3 years ago
Read 2 more answers
PLEASEEE HELPPPP me
insens350 [35]

Answer:

D

Hope This Helps!   Have A Nice Day!!

7 0
3 years ago
Select the correct answer from each drop-down menu. Kristian is a cybersecurity professional. She is writing a book called The D
Papessa [141]

Data sharing, maintaining security

<u>Explanation:</u>

Kristian is a cybersecurity professional. She is writing a book called The Door Toward Cybersecurity. Organizations should avoid any data <u>sharing or exchange</u> while servers are transmitting information. This will help organizations keep the information intact and maintain <u>security.</u> If any info or data shared when the servers are transmitting the info, then it may lead to the loss of security, and the information gets leaked. So it must be avoided to share while transmission of info using the servers.

3 0
3 years ago
Read 2 more answers
What are the benefits of a relationship in RDBMS <br>​
natali 33 [55]

Answer:

To sum up all the advantages of using the relational database over any other type of database, a relational database helps in maintaining the data integrity, data accuracy, reduces data redundancy to minimum or zero, data scalability, data flexibility and facilitates makes it easy to implement security methods.

Explanation:

I hope it helps you..

Just correct me if I'm wrong..

4 0
3 years ago
You are about to install a new USB camera on your Linux system and you realize that there is no device special file available fo
Nonamiya [84]

Answer:

mknod

Explanation:

When the user wants to configure a camera device on his Linux computer and the user recognizes that his device does not have a device-specific file. Thus, the user could use the mknod command on his computer to set up an equipment file because it is the command that is used to create a fresh file and these files are not the same as the normal file.

So, the following answer is correct according to the following scenario.

3 0
3 years ago
Other questions:
  • Please help me
    10·1 answer
  • Describe the components of a CPU--the CU, ALU, and Cache--and explain how they interact to make the CPU function.
    13·1 answer
  • What is the difference between = and == in terms of java..?
    6·2 answers
  • There are....... section in<br>cpu<br>​
    15·1 answer
  • Write a qbasic program to display integer numbers 1 to 100 using the for next loop<br>​
    9·1 answer
  • It is a blueprint of a project​
    9·2 answers
  • Kinda strange, and im good
    11·2 answers
  • How does the number of jobs in internet media compare to the number of jobs in tv broadcasting and print media?
    11·1 answer
  • You would like to see only the last 15 lines of /home/user/log file on your linux machine. Which command line interface (cli) co
    9·1 answer
  • For quantitative data (e.g. the number of milligrams of a drug) coding your data involves?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!