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 full path and filename for the file on a Debian Linux distribution that displays the time zone settings?
lesya [120]

Answer:

/etc/timezone

Explanation:

Debian based Linux distribution is a free distribution software and an operating system. It is composed of a open source and free source software. It is one of the most popular distributions.

A computer file name is a unique system of identifying the computer stored file in the file system. The names of the different file system have different formats or extensions in the file name and imposed different file restrictions.

In the context, the full path and the file name of a file that displays a time zone settings on a Debian Linux distribution is " ../etc/timezone".

3 0
2 years ago
Which of the following is not an advantage of a flowchart?
ad-work [718]

Answer:

d) Improper documentation

Explanation:

A flowchart is a type of diagram in which it presents the flow of the work or how the process is to be followed. It is a diagram that represents an algorithm that defines step by step approach to solving the task. In this, there are various boxes that are linked with the arrows

There are various advantages like in this, there is a better communication, coding is to be done in an efficient way, system could be tested also there is a proper documentation

hence, the correct option is d

4 0
2 years ago
30 mins and I will give Brianlest what is the difference between a method and a function in which ways are they similar why do y
omeli [17]

Answer:

For 1), you should also add that methods in C++ are called member functions. Thus, the difference between functions and methods in this context is analogous to the difference between functions and member functions in C++. Furthermore, languages like Java only have methods. In this case, functions would be analogous to static methods and methods would have the same meaning. For 2), you should add that a method is able to operate on the private instance (member) data declared as part of the class. Any code can access public instance data.   A function is a mathematical construct. I would say all methods are functions but not all functions are methods

Explanation:

8 0
3 years ago
What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
bezimeni [28]

Answer:

accessing the Paragraph dialog box

Explanation:

8 0
2 years ago
Read 2 more answers
I need a 75 word Radio Ad on Why Technology should be kept in a schools budget.
babunello [35]

Answer:

You cant work without it

Explanation:

4 0
1 year ago
Other questions:
  • I need help please?!!!
    15·1 answer
  • The system should enable the staff of each academic department to examine the courses offered by their department, add and remov
    14·1 answer
  • Once consumers arrive at ge’s social media sites, ge must _____ them about its value proposition and related benefits.
    13·1 answer
  • Which type of operating system is usually used in personal computers?
    11·1 answer
  • An attacker compromises the Washington Post's web server and proceeds to modify the homepage slightly by inserting a 1x1 pixel i
    12·1 answer
  • What is random access memory?
    6·2 answers
  • Router 1 is configured with static NAT. Addressing on the router and the web server are correctly configured, but there is no co
    11·1 answer
  • Why is yo utu be down?<br> (You restrict talking about yo utu be, really)
    11·2 answers
  • Two strategies for keeping your files in sync
    6·1 answer
  • True and False(Total points: 10)
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!