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
Verizon [17]
3 years ago
5

At the moment i am tackling the cs50x projects and i need a little bit of help with problem set 1, the 'greedy algorithm'. I am

unsure why my program doesn't work. Can you please help me troubleshoot? My program is attached: The answer to the attached terminal pic is supposed to be 4.

Computers and Technology
1 answer:
mars1129 [50]3 years ago
6 0
That you have to multiply first and then divide
You might be interested in
Exercise : Randomizer In this exercise, we are going to create a static class Randomizer that will allow users to get random int
Nutka1998 [239]

Answer:

Here the code is by using java.

Explanation:

//Randomizer.java

public class Randomizer {

public static int nextInt() {

//get random number from 1-10

int randInteger = (int) (Math.random() * (11) + 1);

//if number is greater than 10 or less than 1

while (randInteger > 10 || randInteger < 1) {

randInteger = (int) (Math.random() * (11) + 1);

}

return randInteger;

}

public static int nextInt(int min, int max) {

//formula to get random number from min-max

int randInteger = (int) (Math.random() * (max + 1) + min);

while (randInteger > max || randInteger < min) {

randInteger = (int) (Math.random() * (max + 1) + min);

}

return randInteger;

}

}

//RandomizerTester.java

public class RandomizerTester {

public static void main(String[] args) {

System.out.println("Results of Randommizer.nextInt()");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt());

}

int min = 5;

int max = 10;

System.out.println("\n Results of Randomizer.nextInt(5,10)");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt(min, max));

}

}

}

OUTPUT:

Results of Randommizer.nextInt()

9

2

3

8

5

9

4

1

9

2

Results of Randomizer.nextInt(5,10)

9

8

9

7

5

10

5

10

7

7

4 0
2 years ago
What is the Is option that prints the author of a file​
sleet_krkn [62]

Answer:

Print.. is your answer...

4 0
3 years ago
What is included on the HP PC Hardware Diagnostics 3-in-1 USB Key that allows you to recover systems that cannot boot?
algol13

Answer:

HP PC Hardware Diagnostics UEFI

Explanation:

The 3-in-1 HP PC Hardware Diagnostics UEFI USB Key helps the client distinguish potential software, hardware, and Operating System issues. Both older and newer HP Desktop and Laptop PCs come with this tool installed. By default, it operates outside the OS to detach equipment issues from other system issues. In the event you do not have it pre-installed, you can get it from the official HP site.

3 0
3 years ago
Some IOS commands store passwords as clear text, but you can then encrypt the passwords with the service password-encryption glo
marta [7]

Answer:

A

Explanation:

Using hashes is preferred because encrypted IOS passwords can be easily decrypted.

8 0
3 years ago
The process of starting or restarting a computer or mobile device is called __________.
Neko [114]
Hi!

When ever we start or restart any device we may hold - this process is called <em>booting. </em>

Hopefully, this helps! =)
3 0
3 years ago
Other questions:
  • Write a program that estimates the approximate number of times the user’s heart has beat in his/her lifetime using an average he
    12·1 answer
  • Maria found a cupcake recipe on a cooking blog. However, she would like to read comments and suggestions before she begins bakin
    6·2 answers
  • Shortcuts will help you complete spreadsheet tasks more efficiently.
    12·1 answer
  • The Magic Square is a grid with 3 rows and 3 columns with the following properties: • The grid contains every number from 1 to 9
    9·1 answer
  • So I’m doing a PowerPoint of how social media changed my life any ideas what I should right down and what kind of topics should
    11·2 answers
  • Does clicking ads and pop ups like the one shown in this image could expose your computer to malware?
    15·1 answer
  • A file name extension provides what information about a file?
    6·1 answer
  • ¿Quién recibe la orden de ejecución de un programa enviada por el usuario?
    9·1 answer
  • Identify the correct characteristics of Python tuples. Check all that apply.
    9·1 answer
  • My game is telling me to "Press any key." Where is the "any" key?????
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!