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?
import java.util.Scanner; public class Project1 { private static int interestYears; private static int numberYears; public int interest; private static double intresetMonth;
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
I'm trying to turn into an android app, but I have limited Java knowledge.It's not a super complex app so I figured I could figure it out on the fly with some tutorials and such. But I need to emulate this curl connection and I'm not sure how in Java.
I am unable to understand the use of String intern. Why not use Code 1 as given below instead of using intern as in Code 2? Both perform the same functionality.
I am trying to implement a file upload functionality. One of the requirement is to display a 'Please Wait!!!' message to the user while the upload is going on. My project currently uses JSF 1.2, Tomahawk, JQuery 1.9, JQuery UI 1.10. I am aware that this can be accomplished using a4j with richfaces, however I am not supposed to add any new library to the existing project. how this can be done?
Am trying to develop a web application, and am using the Entity Manager. The web application involves users posting data to the database. How do I incorporate the entity manager together with the prepared Statement functionality to avoid users corrupting the database with SQL tags?
If I have EJB database session beans, when the content of the database changes, does the information on the web page get automatically updated dynamically on the client machine?
A team of programmers is reviewing a proposed API for a new utility class. After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality. If they implement the new design, which two OO principles will they be promoting?
I just kinda get stuck when it comes to passing values into constructors, using main method or static method functionality. In theory i kind of understand how it work but when i type it, it's totally different! I have to have a junit test too but i guess i could do that in the end.
I have attached the assignment. So, how to proceed with this:
public class Flight { int flight_number, capacity, number_of_seats_left; String origin, destination; String departure_time; double original_price;
I want to implement session timeout functionality ...so with web.xml file i can specify session timeout ..say 30 min.. Now with filter is it possible for me to redirect the request to login page after session is timeout say after 30 min... What are the other ways...??
Also i want to know whether timeout setting in web.xml will overweight the application server timeout ... I am using struts 1.0 and hibernate...
So, I'm working on a Tip Calculator for fun. I have everything worked out for the most part. The feature I am trying to add is to give the user the amount of change they'll get back from their transaction. I do not ask the user any information other than what is their bill.
Please enter your bill total : 5.50 Please enter your name : some name Total : 5.50 Tax : 0.48 -- Based off a tax rate of 8.75% Total with Tax : 5.98 -- 20 percent Tip : 1.10 Total with Tax and 20 percent Tip : 7.08 Total change : <-- I believe this will be about $2.92
I want the total bill to round to the nearest $10 value (e.g. for $5.50, calculate bill to $10. For $13.00, calculate bill to the $20.00, and so on... This way I get an accurate amount of change to give back to the user.
I made a MVC calculator. I was wondering if you could take a look at my design and if I was on track. I am still working on getting it to actually calculate something. All the buttons respond and print text on the JTextField but it is not calculating.
package calculator.MVC; import javax.swing.JButton; import javax.swing.JTextField; public class CalculatorModel { private int sum; private int number; private char opt;
I am making a calculator in Java. However, when I press the "=" button on my calculator, it always returns 0.0, no matter what. I don't understand why? The code is below:
import javax.swing.*;//import the packages needed for gui import java.awt.*; import java.awt.event.*; import java.util.Arrays; import java.util.List; import static java.lang.Math.*; public class CalculatorCopy {
import javax.swing.*; public class BasicCalculator{ public static void main (String[] args) { String output=""; double n1,n2; String operation; operation= JOptionPane.showInputDialog("Please enter your operation");
I have the basic workings of this program just doing all the printing at the end is throwing me off. Anyway here are some of the requirements and my code:
1. Allow the user to input an individual's hours worked. 2. Accumulate the total regular hours worked, the overtime hours worked, the amount of the regular pay, the amount of overtime pay, and the total payroll, for all of the employees entered. 3. Allow the user to enter a zero (0) as the Boolean expression to end the loop. 4. When the loop ends print out all of the accumulated totals with appropriate labels, each on a separate line.
import java.util.Scanner; public class WhileLoopPayCalc { public static void main(String [] args) { final double REGULAR_HOURS = 40f; final double HOURLY_WAGE = 12.5f; final double OVERTIME = 1.5f;
I am facing problem during calculation in my awt calculator. It is showing NumberFormatException. Below is part of code.
if(e.getSource()==b14)//On button 14, label is "/" { String v1=tf.getText().toString(); num1=num1+Integer.parseInt(v1);//num1 is as integer variable tf.setText("");//tf means textField }else
I'm new to java and have been coding for a few hours. I tried to create a calculator (Which has no GUI, just text inputs)which will let you select how to process the two integer (Add, minus, times etc.) I cant seem to get it to work. I will put in the process way such as times and have entered two integers and every time it doesn't work. Here is my code:
import java.util.*; public class Calculator { public static void main (String args[]) { int input1 = 0; int input2 = 0; int answer = 0;
I am currently working on a small java programm. I use netbeans for it. And obviously I am new to java.
Basically its a calculator that change the input value into another value: like 10 € into whatever $ and same with Inch and Centimeters.
Therefore I need a second jDialog Form where i can change the factors for the calculator and start the calculator again.
Here is my problem: I can open the second Dialog but if I want to change the factor it doesn't change the value in the variable and the second calculator frame is with the old factors. It seems the double variable isn't working globally
So I am working on a PostFix calculator that is used in command line for a class project, and I am having a little trouble on developing a memory for it. I have been told to create a hashMap and I have researched it and understand the basics of it. I have the calculating method working, but what I am having trouble trying to implement a way for the user to declare variables. For example this what the user should be able to do:
> a = 3 5 + 1 - 7 > bee = a 3 * 21 > a bee + 28
[code]....
I just need to be able to save the answers as a variable the User names, such as the example and let the user be able to use the variables later.
the program basically has a random number generating, and I want to ask the user to try to guess the number, and keep guessing until the number is right. In addition to this, I need to put in extra conditions for too high or too low by 10. So for example, if they user guesses a number and its off by more than 10, then it prints that they guessed too high, and if its below 10 they guessed too low.
import java.util.*; public class RandomNum { public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
[code].....
Modify the program to keep the user trying to guess the number till he/she gets it right, and stop once you guess the right number.Too high, high, too low, too low( If it's off by more than 10 = way too high, if its less than 10, way too low)
my task is to add a few functions to an example calculator. I managed to add a divide button but I simply can't figure out how to add a working Pi and reciprocal function.
package newjavaproject; import java.awt.*; import java.awt.event.*; import java.applet.*; public class CalculateurNC extends Applet {