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]
3 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]3 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
What is the role of the W3C? Group of answer choices oversee research and set standards for many areas of the Internet supervise
Murljashka [212]

Answer:

oversee research and set standards for many areas of the Internet

Explanation:

World Wide Web Consortium was created to maintain a standard order in the cyber world. It is an international community formed by the organizations as a member. W3C sets the standards of the websites and enables them to function and appear the same in every web browser. A specific standard of guidelines, rules, and protocols are fixed so that the World Wide Web can function and grow respectively.

5 0
3 years ago
What is the best wi-fi name you have ever seen?
elena-s [515]

Answer:

bill wi the science fi

Explanation:

8 0
2 years ago
Of the following which would be the best data representation for this puzzle in a puzzle class?
sladkih [1.3K]

please include the puzzle and or questions.

5 0
3 years ago
What is renewable energy
Marat540 [252]
Renewable energy is energy that is collected from renewable resources, which are naturally replenished on a human timescale, such as sunlight, wind, rain, tides, waves, and geothermal heat.
8 0
3 years ago
A computer program that enables users to create and work with files and folders is called what?
murzikaleks [220]

Answer:

File manager

Explanation:

From the list of options 1 to 4, only option (2) is correct

Explaining the options one after the other

  • Web browser: It lets users access the internet
  • File Manager: Used to create and manage files/folders
  • User Interface: Means which the user of a computer interacts with the computer
  • File Reader: Used to read the content of a file. e.g. Adobe reader for pdf files, Notepad for text files, etc.

Having explained the options one after the other, <em>the file manager </em>is the answer to this question.

3 0
2 years ago
Read 2 more answers
Other questions:
  • Software license infringement is also often called software __________.
    11·2 answers
  • In doing a load of clothes, a clothes drier uses 18 A of current at 240 V for 59 min. A personal computer, in contrast, uses 3.0
    7·1 answer
  • What is the name of the port that you plug an ethernet network cable into?
    6·1 answer
  • A work-study student receives a paycheck from:
    15·2 answers
  • What is the maximum amount of memory that vmachine1 can use in its current configuration with startup ram set to 1024 megabytes?
    14·1 answer
  • How do the companies gather data to determine common passwords?
    13·1 answer
  • Good ways to increase sales on phone accesories?
    10·2 answers
  • You are given an integer N, followed by N lines of input (1 &lt;= N &lt;= 100). Each line of input contains one or several words
    8·1 answer
  • Select the correct answer.
    7·2 answers
  • What is the total number of time zones that can be configured to show by default in a calendar in Outlook 2016?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!