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 8864199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:10:54+00:00 2026-06-14T16:10:54+00:00

am only getting the interest amount an not the amount i suppose to pay

  • 0

am only getting the interest amount an not the amount i suppose to pay a month can you please tell me where am going wrong thanks.

import java.util.Scanner;

/**
 *
 * @author 
 */
public static void main(String[] args) {
       Scanner input = new Scanner(System.in);
       //variabled decleared
       double rate;
       double payment;
       //input
       System.out.print("Enter Loan Amount:");
       double principal = input.nextDouble();
       System.out.print("Enter Annual Interest:");
       double interest = input.nextDouble();
       System.out.print("Total payment type:");
       String period = input.next();
       System.out.print("Enter Loan Length :");
       int length = input.nextInt();

       //proces
       rate = interest / 100;

       if (period.equals("monthly")) {
           double n = length * 12;
           payment = principal * (rate * Math.pow((1 + rate), n) / Math.pow((1 + rate), n));
          System.out.printf("Your Monthly Sum is %.2f",payment);
       }
}
  • 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-14T16:10:55+00:00Added an answer on June 14, 2026 at 4:10 pm

    Your error is here:

    principal * rate * Math.pow((1 + rate), n) / Math.pow((1 + rate), n)
    

    This is the same as having only principal * rate. You are saying x = b * a / a.
    Replace to:

     payment = principal * Math.pow((1 + rate), n);
    

    n is the number of years, you can not do n = length / 12 to get Monthly. You should do instead:

    payment = (principal * Math.pow((1 + rate), n)) / 12;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can any one tell me why im only getting flag inserted into my tables
As you can tell from the image below I'm only getting one row back
I'm getting awful lot of spam to my forums where only registered users can
I'm getting a Null pointer access: The variable 'numbers' can only be null at
I'm only getting the default validator message. What am I doing wrong? class Questao
I'm trying to use JOIN but it seems I am only getting half of
I bet this is loop 101 but here it goes. I am only getting
This is for SS 2005. Why I am i only getting 4000 characters and
I'm new to Unit Testing, and I'm only getting into the routine of building
Is the only way of getting the address of an address in C (opposite

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.