Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:40:13+00:00 2026-06-14T10:40:13+00:00

I am to create a program in Java using multiple methods inside the driver

  • 0

I am to create a program in Java using multiple methods inside the driver class. Previously, we have only used the main method in such applications.

I know I am to use something like this:

public static void main(String[] args)
{
    U4A4 u = new U4A4();
    u.run();
}

to run the method public U4A4().

Yes, I know this is terribly basic, but I’ve been searching around all evening and I thought someone here might be able to put it in simple terms how exactly I should do this.

My compiler is getting mad when I try to put in public class U4A4 implements Runnable at the top of my code (it’s right after my imports) and starts wanting me to make it abstract. I have no idea what that is.

So, where do I put implements Runnable and where do I use run()?

Thank you so much for bearing with me here.

Edit: This is what I’ve got so far. http://pastebin.com/J8jzzBvQ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:40:15+00:00Added an answer on June 14, 2026 at 10:40 am

    You have implemented Runnable interface, but not overriden the run method of that interface. I have commented code where you will have to place your thread logic so the thread will work for you.

    import java.util.Scanner;
    
    public class U4A4 implements Runnable
    {
        private int count = 0;
        private double accum = 0;
        private int apr, min, months;
        private double balance, profit;
    
        public static void main(String[] args)
        {
            U4A4 u = new U4A4();
            u.run();
        }
    
        public U4A4()
        {
            Scanner in = new Scanner(System.in);
    
            System.out.print("Enter credit card balance: ");
            balance = in.nextDouble();
            System.out.print("\n\nEnter minimum payment (as % of balance): ");
            min = in.nextInt();
            System.out.print("\n\nEnter annual percentage rate: ");
            apr = in.nextInt();
    
            profit = this.getMonths(balance);
    
            System.out.println("\n\n\n# of months to pay off debt =  " + count);
            System.out.println("\nProfit for credit card company = " + profit + "\n");
        }
    
        public double getMonths(double bal)
        {
            double newBal, payment;
            count++;
    
            payment = bal * min;
    
            if (payment < 20 && bal > 20)
            {
                newBal = bal * (1 + apr / 12 - 20);
                accum += 20;
    
            } else if (payment < 20 && bal < 20)
            {
                newBal = 0;
                accum += bal;
            } else
            {
                newBal = bal * (1 + apr / 12) - payment;
                accum += payment;
            }
            if (newBal != 0) {
                getMonths(newBal);
            }
    
            return accum;
        }
    
        public void run() {
            // TODO Auto-generated method stub
            // You have to override the run method and implement main login of your thread here.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple chat program using Java. I have create
I have created Excel Sheet using Java program. It works fine. My problem is,
I have a Java program using a basic Hibernate session factory. I had an
I am using java trying to create a program. What I am trying to
I was using swing to create a program/start menu for my java program. What
I am using a native C++ library inside a Java program. The Java program
I am trying to create a MonkeyRunner program in Java using Eclipse but :
I want to create a C/S chat program in java using socket, and now
In a java program, I create a file with File temp = new File(temp);
I want to create registry key through java program to add the jar file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.