Mortgage Calculator - Monthly Payment Is Not Getting Out Correctly
Sep 25, 2014
This is for a mortgage calculator and we have to use the math.pow method. I am getting results, but the results are wrong. The monthly payment is coming out to big.
Here is what it should be:
Enter loan amount: 10000
Enter rate: 4.5
Enter number years: 3
The monthly payment is: $297.47
Here is what I'm getting.
Enter loan amount: 10000
Enter rate: 4.5
Enter number years: 3
The monthly payment is: $566.06
Here is my code. I believe my issue is in the math.pow formula.
Scanner in = new Scanner(System.in); // input object
double loanAmount; //user input
double interestRate; // user input
double yearNumber; // user input
double monthlyPayment; // answer to math
double finalPayment; // output
double monthNumber; // year number converted of months
double monthlyRate; // converted intersted rate
[Code] ....
The monthly payment is: $%.2f", monthlyPayment); // Shows monthly payment
View Replies
ADVERTISEMENT
Jun 11, 2014
I want to Write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance.
the Amount is 3,500 the annual rate is 9.9%, the minimum payment is 2% a month. the fixed payment is 150.
By a fixed monthly payment, we mean a single number which does not change each month, but instead is a constant amount that will be paid each month.
The program should print out :
payment information:
new balance total .......
current payment due .......
if you make minimum payment (2%) you will pay of in .... months and you Will end up paying an estimated total of $........
if you make the fixed rate payment, you will pay of in .... months and you Will end up paying an estimated total of $........ and you will save $........
View Replies
View Related
Apr 18, 2015
How to make my program look nice. I have to create a mortgage calculator with no functionality, so it basically just has to be a window that looks like this:
Here's my code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MortgageCalculator {
public static void main(String[]args) {
CalcWindow calculator = new CalcWindow();
[Code] .....
Here is the output I am getting:
How do I make my program output look similar to the 1st picture?
View Replies
View Related
Feb 11, 2015
import java.util.Scanner;
public class Project1 {
private static int interestYears;
private static int numberYears;
public int interest;
private static double intresetMonth;
[Code] ....
View Replies
View Related
Jan 20, 2011
How to implement the payment gateway in java.
View Replies
View Related
Nov 26, 2014
calculate how long it would take to pay off a loan of 500 pounds if there was 10% interest monthly, and 100 pounds was paid each month. This code is in a pseudocode,
set months = 1
set balance = 500
set totalpaid = 0;
while balance > 100
balance = balance - 100;
set interest = balance * 0.1
balance = balance + interest
totalpaid = totalpaid + 100
months = months + 1
endwhile
totalpaid = totalpaid+balance
display "you paid "+totalpaid
display "It took you "+months+" months"
View Replies
View Related
May 29, 2014
I started taking a java programming class javascript eclipse The program says it wants a monthly temperature chart of two places..Declare an array of values for Blueville temperatures and another array for Orlando temperatures. Then, use what you have learned to produce a program to output the following table:
Blueville Monthly temperatures
jan feb mar apr may jun jul aug sep oct nov dec
3 3 5 10 16 20 24 23 16 10 5 3
Orlando Monthly Temperatures
jan feb mar apr may jun jul aug sep oct nov dec
14 16 12 23 24 25 27 30 25 22 17 15
The warmest month in Blueville is _______
The warmest month in Orlando is ________
The month with the greatest temperature spread is __________
View Replies
View Related
Feb 20, 2011
What to do with this JAVA code?
This is the code that I need to do without using the Joptionpane:
An Internet service provider has three different subscription packages for its customers:
Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour.
Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour.
Package C: For $19.95 per month unlimited access is provided.
Write a program that calculates a customer's monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were used. It should then display the total charges.
This is what I have so far : Cannot use Joptionpaneshowinputdialog
/* A demonstration of how to use Decision Structures
import java.util.Scanner;
/**
This program demonstrates a switch statement.
*/
public static void main(String[] args)
{
char packageLetter;
int hoursUsed;
[Code] ....
View Replies
View Related
Dec 21, 2014
I am doing a program where i have to implement a payroll system into a company for hourly, fixed monthly and commission paid workers. I also have to put the method which i did. the problem is I cant tell if my calculation is wrong or if i am missing a codes some where. The output is not giving me the answer that I was at least expected,
Here is my method:
{
< double total_deduction;>
< total_deduction = gross_pay - deduction;>
< return total_deduction;>
}
< public static double calGrossH(double hours_worked, double pay_rate)>
[Code] .....
I have done a lot researching and have come up with some search with almost the same calculation and I have also asked employees of a company on how they calculated hourly rate, commissions rate and fixed rate for all workers and gotten the same response but for some reason the output is not what it is supposed to output. here is my output.
<
un:>
<please enter the number of employees to be processed 31>
<please enter employee id number 3669>
<please enter employee first name>
[Code] ....
I dont know if I am missing some calculation somewhere or codes been researching and bussing my brains to figure out where is the missing codes or calculation.
View Replies
View Related
Jun 26, 2014
I am trying to build an app for managing expenses to practice with java programming. I am stuck on the ActionEvent block. The program i am trying to make needs to minus the expenses from the monthly income and display the net income in JLabel.
package mybudgetapp;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
[Code] .....
View Replies
View Related
Apr 23, 2015
I am building a program that when you enter 1. it allows you to setup an item. However running my code my second if statement runs through.
import java.util.Scanner;
public class InventorySystem {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int count=0;
int inputEntered=0;
int numberOfItems=0;
double cost=0.00;
String item;
String description;
[code]...
View Replies
View Related
Feb 13, 2014
So i am creating a File object which has a text file passed to it. I then try to do logic with it using a BufferedReader. However, I get a FileNotFoundException on the using my code below. The Error is on the BufferedReader line. I
Java Code: System.out.println("--Reading text file--");
File file = getFile(c,fileName) // Returns a File object.
System.out.println(file); // Shows me the file is looking correct. Displays contents to console.
BufferedReader br = new BufferedReader(new FileReader(file));
System.out.println("BUFFERED");
while((line = br.readLine()) != null) {
try {
// Do Logic
}
catch(Exception ex){
ex.printStackTrace();
}
br.close(); mh_sh_highlight_all('java');
View Replies
View Related
Jan 27, 2014
Trying to learn switch statements. Can't figure out what I am doing wrong.
java Code:
import java.util.Scanner;
public class Ok1 {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
[code]...
When I run, it makes me enter letter = null and it wont output correctly.
View Replies
View Related
Sep 27, 2014
I want to write simple game. Why if I press button UP and RIGHT it not move diogonally, may be it have special code. And how I need to write correctly border and gravity?
public class Main {
public static void main(String args[]) {
JFrame frame = new JFrame("Stickman");
Ground ground = new Ground();
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.setSize(710, 480);
[code]....
View Replies
View Related
Mar 25, 2014
I am trying to implement a game using the ACM graphics. For the game, I am trying to make the main frame a Grid of Cells.I made a Grid class which extends GCanvas:
import acm.graphics.GCanvas;
public class Grid extends GCanvas{
private final static int WIDTH = 300;
private final static int HEIGHT = 300;
private final int DIMENSION = 5;
Cell[][] grid;
[code]....
View Replies
View Related
Sep 4, 2014
If I run this code. I can manipulate it so that X wins. When the third X button is pressed, there is no display saying that X has won and that the game is over. I have read over this code for days and still have not figured it out.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TicTacToe extends JFrame implements ActionListener, WindowListener{
public JFrame window = new JFrame("window");
[Code] ....
View Replies
View Related
May 26, 2014
I am currently trying to make a method that will enable a jLabel to be dragged across the screen. I want to be able to drag the object pretty much anywhere on the screen(I hope to eventually make a destination for it where it can be dropped but I will get to that later). I have looked on various places on the internet on how to achieve this and the most simple solution does something like this:
Java Code:
jLabel6.setText("jLabel6");
jLabel6.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
jLabel6MouseMoved(evt);
}
});
private void jLabel6MouseDragged(java.awt.event.MouseEvent evt) {
x = evt.getX();
[Code]...
This actually works somewhat but it is very faulty. For example the jLabel keeps appearing and reappearing as I drag it. Furthermore when I drag it I can see a duplicate Jlabel being dragged as well in the top left hand screen. So how might I fix this?
View Replies
View Related
Nov 29, 2014
I am trying to write a date program. I have it written and running correctly, except one issue. I cannot get the numerical date to display correctly. I know it is an issue with printf. I don't know anything about printf. Here is my method to return the day
public int getDay() {
return day;
}
When it returns, it is literally returning just the numeric date. I need it to show up as 02 or 03 instead of 2 or 3, respectively.
View Replies
View Related
Sep 8, 2014
the dates are printing out of order. It should appear MM/DD/YYYY however with my code its printing DD/YYYY/MM.Here is my code.
public class DateTest {
public static void main(String args[]){
Date date1 = new Date( 7, 4, 2004 );
System.out.print( "The initial date is: " );
date1.displayDate();
[code]....
View Replies
View Related
Mar 17, 2014
how to calculate the child's height in float value fixing value where if you choose male the accurate value, but if you choose female the value will be accurate too.
int heightMother, heightFather;
int heightMaleChild, heightFemaleChild;
String gender;
[code]....
View Replies
View Related
Dec 12, 2014
I'm unable to get the output for "AverageDriver" to print correctly(5 scores in descending order and average). The output displays the scores the same way they are entered and the average is always zero. The output for the Average program works fine and with the correct output.
import java.util.Scanner;
//This class keeps 5 scores entered by the user
public class Average
{
private int[] data;
private double mean;
public Average()
[Code] ....
View Replies
View Related
May 7, 2014
I cannot get the data file to print out correctly when I go to the display case. It only prints one name three times.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.util.Scanner;
import java.io.*;
import java.text.*;
import java.math.*;
import java.util.StringTokenizer;
[Code] ....
Output when I choose Case 1:
Minia
Minia Jane
Minia Jane
View Replies
View Related
Nov 6, 2014
My console SQL Query app is not giving me the desired output.I am sure its might have something to do with my SQL Query.Its missing the description of the stock items and it prints a new line for each user as per number of stocks an repeats the user details and then prints the stock listed by that user(only want the user listed once with all its stocks). I will add my files and current output and desired out put below.
MakeDB.java:
import java.sql.*;
import java.io.*;
public class MakeDB
{
public static void main(String[]args) throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:StockTracker";
[Code] .....
View Replies
View Related
Nov 9, 2014
I'm working on a homeowork assignment here URL... and I can't get the graph to work correctly. I'm not really sure how to print the string of names, gender and rank at the point on the graph. Also I'm just wondering if I set up the scanner to find names right.
import java.util.*;
import java.io.*;
import java.awt.*;
public class Names {
public static final int year = 1880;
public static final int decades = 14;
public static final int decadeWidth = 70;
[code]....
View Replies
View Related
Jan 21, 2015
I have two programs that talk to each other over a TCP connection. When I write the data "STX+1234" where STX is the Ascii character STX or Ctrl B and I expect the written String length to be 6 which it is. On the other side of the socket I create the ServerSocket and use the client socket's InputStream to create a BufferedReader. When I receive the string it now has 12 characters where each original character has been replaced by NUL and the character. How do I read the string as it is originally specified without the conversion? And is the problem on the reader side or the writer side?
View Replies
View Related
May 26, 2014
I'm having a problem with SplitPane (horizontal Flow). What I'm looking for is to find a way to maintain the left pane in the same position when the main window maximizes. I do not want the left pane to grow on its width. If I go into the AnchorPain Constraint in the Scene Builder and remove the right and left constraints, when I run the application, the left pane keeps its position, but it appears a gap between the two panes (the left pane and the right one).
I need to find the way to expand the right pane to the position where the left pane is.
The link shows an image that illustrates the problem. [URL]
View Replies
View Related