Question

In: Computer Science

I am given this starter code and I am suppose to debug it and all of...

I am given this starter code and I am suppose to debug it and all of that and it will not work after I change ">" to "<=" and then i'm not sure after that what else I have to do. Could someone help me solve this?

// Start with a penny
// double it every day
// how much do you have in a 30-day month?
public class DebugSix1
{
   public static void main(String args[])
   {
      final int DAYS = 30;
      double money = 0.01;
      int day = 1;
      while(day > DAYS);
      {
         money = 2 * money;
         ++days;
         System.out.println("After day " + day +
            " you have " + moneyAmt);
      }
   }
}

That is the starter code. This is with the Java Programming 9th edition by Joyce Farrel and the other tutorials i have found do not show it with this starter code so I am confused.

Solutions

Expert Solution

// Start with a penny
// double it every day
// how much do you have in a 30-day month?
public class DebugSix1 {
    public static void main(String args[]) {
        final int DAYS = 30;
        double money = 0.01;
        int day = 1;
        while (day <= DAYS)
        {
            money = 2 * money;
            System.out.println("After day " + day + " you have " + money);
            ++day;
        }
    }
}



Related Solutions

I am using NetBeans IDE Java to code and I am seeking comment to the code...
I am using NetBeans IDE Java to code and I am seeking comment to the code as well (for better understanding). Magic squares. An n x n matrix that is filled with the numbers 1, 2, 3, …, n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value. Write a program that reads in 16 values from the keyboard, displays them in a 4...
I am trying to write a python code to create a function that returns all possible...
I am trying to write a python code to create a function that returns all possible dimensions (reshaping) for an input matrix, can someone explains the math and write a python code with explaining all the steps and give me a test cases, and please explain if there is more than one approach. so if we have 1*8 matrix we should return 1*8, 2*4,4*2,8*1 def reshaping(M) should return a n ORDERED list AND the all possible reshaped matrices
I am having an issue with the code. The issue I am having removing the part...
I am having an issue with the code. The issue I am having removing the part when it asks the tuter if he would like to do teach more. I want the program to stop when the tuter reaches 40 hours. I believe the issue I am having is coming from the driver. Source Code: Person .java File: public abstract class Person { private String name; /** * Constructor * @param name */ public Person(String name) { super(); this.name =...
please debug this code by fixing all the mistakes. thank you. // Creates a HomeworkAssignment class...
please debug this code by fixing all the mistakes. thank you. // Creates a HomeworkAssignment class // instantiates two objects // and prompts the user for infromation about two courses using System; public class DebugSeven1 {     public static void Main()     {         HomeworkAssignment course1;         HomeworkAssignment course2;         string entryString;         int exercises;         // Get info for first class         Console.Write("What class do you have homework for? ");         entryString = Console.ReadLine(); // Fixed .ReadLine         course1.ClassName...
I am trying to get this code to work but I am having difficulties, would like...
I am trying to get this code to work but I am having difficulties, would like to see if some one can solve it. I tried to start it but im not sure what im doing wrong. please explain if possible package edu.hfcc; /* * Create Java application that will create Fruit class and Bread class * * Fruit class will have 3 data fields name and quantity which you can change. * The third data field price should always...
Please fix this code I am having issues compiling it all together there is 3 codes...
Please fix this code I am having issues compiling it all together there is 3 codes here and it's giving me errors in my main method..... I feel like it might be something simple but I can't seem to find it. package assignement2; import java.util.ArrayList; import java.util.Scanner; public class reg1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the number of items: "); int number = input.nextInt(); input.nextLine(); for (int i = 0; i <...
Into to PythonInstructions: • In this lab you are to debug the code found at...
Into to PythonInstructions: • In this lab you are to debug the code found at the end of these instructions: Find and correct all problems found in the code. Create comments in the code explaining what you found and how you corrected it • The purpose of this program is to calculate car insurance rates using the following rules: The base rate of insurance is $50 a month, Males pay a 25% premium over the base rate, Drivers in Michigan...
I am working on routing path and subnet. The question is I am given with source...
I am working on routing path and subnet. The question is I am given with source 10.1.240.240 and the destinations is 10.2.240.240. How is the packet traveling?
Hello, I am working on a C-program that deals with memory mapping, Please show all code...
Hello, I am working on a C-program that deals with memory mapping, Please show all code (code must be in the C) and outputs. The instructions are as follows INSTRUCTIONS: You have two sample c codes, one for the client and one for the server. IF the client makes a change in the shared memory, those changes will show on the server side. Your task is to adapt the change strategy to develop two applications so they can send messages...
Please, this is the fifth time I am posting this question, all the answers I am...
Please, this is the fifth time I am posting this question, all the answers I am getting are inaccurate because the experts are not putting all value into account like the loan interest rate, tax rate, depreciation, annual cash outflows, salvage value, annual cash inflows, and discount rate. please also support the answer with a full interpretation and the step by step approach in solving the answer. thank you:) In this paper, please discuss the following case study. In doing...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT