Read Amount Of Minutes / Displays Approximate Number Of Years / Days For Minutes
Sep 7, 2014
I need to write a simple program that reads an amount of minutes and displays the approximate number of years and days for the minutes. For simplicity, assume a year has 365 days and the resulting amount of days is a whole number.
View Replies
ADVERTISEMENT
Sep 19, 2014
I'm fairly new to JSTL. Can I convert the minutes JSTL expression into hours and minutes using a java method. I'm not sure how to go about.
<% CalendarUtilities.getHoursAndMinutes(%> ${minutes} <% ) %>
View Replies
View Related
Apr 7, 2014
I have a timer where it counts down from 300 to 0 then does something. But I want the display for the clock to show the time in minutes. I tried:
double showTimeLeft = timeLeft / 60;
o.setDisplay(String.format("%.2f", showTimeLeft) + " Minutes");
But Every so many seconds it skips like:
Time = 3.38
Time = 3.37
Time = 3.35
Time = 3.34
It skipped 3.56
How to do this right?
View Replies
View Related
May 29, 2014
import java.util.Scanner;
public class days
{ public EnumTest ()
{ this.day = weeks/months/years}
final int daysInMonth = 30; //constants
final int monthsInYear = 12;
final int daysInWeek = 7;
public void convert()
[Code] ....
after compiling it shows invalid method declaration ; return type required.
View Replies
View Related
Mar 14, 2014
Here's the small project... but how can I return the value (amount) in 10 years ? The way I did, the program just doesnt return anything...
import java.util.Scanner;
public class FutureValue
{
public static void main (String []args) {
double amount = 0;
double apr = 0;
System.out.println("How much money would you like to invest?");
[Code] ....
View Replies
View Related
May 1, 2014
I have a servlet with a method:
/**
* @return <code>double</code> Hours
*/
public double getDriveHours() {
return getAsDouble("DriveTime", 0.0D);
}
I would like to change the time to minutes. I will create a new entry in the db for the minutes, but wondered if the time minutes is also double.
View Replies
View Related
Mar 10, 2014
I have a web application where the server has to write the excel document to the output stream.It takes more than 5 minutes for the server to write it.After 5 minutes i get a '504 gateway timeout' error code. I have tried setting the timeout values in the web container in Admin Console.Still the same problem.I followed this link.
[URL] ....
I even tried setting the ConnectionKeepAliveTimeout and ConnectionIOTimeOut values. But still didn't work. How do i increase the timeout value?
View Replies
View Related
Dec 10, 2014
I have this code for a Countdown Timer...
Java Code:
package javaproject;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import Countdown.Timer;
import java.util.Timer;
import javaproject.Countdown;
public class Minutes {
[Code] ....
Do I need to put more code in the Countdown class or in the Minutes Class...
View Replies
View Related
Dec 1, 2014
I'm trying to put in a countdown timer into my project, but want to get it working first. I am finding trouble because I have a couple of errors.
Java Code:
package Project;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Minutes {
int count = 30; //Integer count is set equal to 30.
int delay = 1000; // Integer delay is equal to 1000. 1000 being in milliseconds which is 1 second.
[Code] .....
View Replies
View Related
Jul 1, 2014
I'm on windows 8 and I want to use notepad or notepad++ to simulate the press of the space bar every 15 minutes so my computer doesn't auto lock.
View Replies
View Related
May 19, 2014
I'm using this methodology for Java connection between client and server, the server allows the user to stay connected while it is sending messages, but if you stay an average time of 5 minutes without send anything it is disconnected, I need to increase that time to about 30 minutes or disable this disconnection for inactivity.
Settings:
Netbeans 8.0
Windows Seven 64 Bits Ultimante
The following code:
package redes;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
[Code] .....
View Replies
View Related
May 19, 2014
I'm using this methodology for Java connection between client and server, I copied it from the internet, but the server allows the user to stay connected while it is sending messages, but if you stay an average time of 5 minutes without send anything it is disconnected, I need to increase that time to about 30 minutes or disable this disconnection for inactivity.
Settings:
Netbeans 8.0
Windows Seven 64 Bits Ultimante
The following code:
package redes;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.PrintWriter;
import java.net.Socket;
[Code] ....
View Replies
View Related
Apr 27, 2013
I want to compare two times. What I am doing is
java.util.Date date = new java.util.Date();
java.sql.Time cur_time = new java.sql.Time(date.getTime());
/*this is my database connectivity code from where I am getting second date that I am comparing. This is right. Don't bother it.
Connection c= ConnectionManager.getConnection();
String sql = "select t from datesheet where subjectCode=? and sessional=? and d=?";
PreparedStatement ps = c.prepareStatement(sql);
ps.setString(1,subjectCode);
ps.setString(2,sessional);
ps.setDate(3,cur_date);
ResultSet rs = ps.executeQuery();*/
if(rs.next())
{
java.sql.Time t = rs.getTime("t");
long diff = cur_time.getTime()-t.getTime();
}
Then I am converting it to seconds, minutes and hours, but the problem is time that we get from cur_time.getTime() has more digits than time that we get from t.getTime(), so it is always greater than t.getTime() even when it is not.
long seconds = (diff/1000)%60;
long minutes = (diff/60000)%60;
long hours = (diff/(60*60*1000))%24;
View Replies
View Related
Dec 9, 2014
Finding a strategy that allow process 12 millions of records in less than 1 hour. Each record can be modified by business rules. In this process are performed insert, update and select in other 3 tables.
The end result of this process is update monetary fields (for the calculations is used BigDecimal) of records in another table.
This process is part of the migration of Cobol to Java/Oracle. In cobol this process takes approximately one hour. Is it possible?
View Replies
View Related
Oct 21, 2014
so I had to make a program that prompts the user to enter a loan amount and the years for the loan and I have the conversions and everything my only issue is that when the chart pops up it just looks like a bunch of numbers and its missing the column headers
for example
Interest Rate Monthly Payment Total Payment
import java.util.Scanner;
public class InterestRate {
public static void main(String[] args) {
double monthlypayment = 0;
double totalpayment = 0;
Scanner input = new Scanner(System.in);
System.out.println("Enter Loan Amount");
[Code]...
View Replies
View Related
May 13, 2014
I have an application which is doing a fine job of placing the total hours on the interface.
Where I am breaking down is that I am unable to split the string into two distinct groups: hours and minutes
private HtmlElement createTravelTimeRow(ShowSet showSet) {
HtmlElement tr = new HtmlElement(ROW_OPEN, ROW_CLOSE);
HtmlElement td = new HtmlElement(CELL_OPEN, CELL_CLOSE);
[Code].....
I came across something which showed how to split the String but I am still very unsure how to do this.
View Replies
View Related
Jul 29, 2014
I am trying to run a class with a client code and I get the following error
The method add(TimeSpan) is undefined for the type TEST
Why i get this error?
package timespan;
// Represents a time span of hours and minutes elapsed.
// Class invariant: minutes < 60
public class TimeSpan {
private int hours;
private int minutes;
[Code] ....
View Replies
View Related
Feb 9, 2015
I am working on an assignment that I can't seem to figure out the final part to. The program takes in course data such as the time the class starts and how long it lasts. The time is in military time (0000 - 2400)
I need the output time to be the time the class started, plus the length of the class, and displayed in military time.
for example,
Start Time = 0930
Length = 50 minutes
Endtime = 1020
I can't for the life of me figure out how to do this. I have gotten a program that works for this time and minutes, and displays the correct 1020. But when I change the information to say
Start time: 0700
Length = 90 minutes
I get:
Endtime = 90
90 is technically correct, the way the formula is setup, but I need it to display 0900 not 90.
Here is the code that I have. Be easy, I'm still learning, and this is just the file I created to get the formula to work. Also, the verbose in here is just for my own debugging to make sure values should be what I'm expecting them to be.
public class calc
{
public static void main(String[] args) {
double hours, minutes, length;
double temp;
int time = 2400;
hours = time / 100;
System.out.println("Hours are: " + hours);
[Code] ....
View Replies
View Related
Jun 29, 2011
I'm trying to write a program that computes the number of days between two dates. How I can achieve this. I'm quite sure I'm supposed to use the Calendar class.
View Replies
View Related
Apr 22, 2015
The intent of the code is to read date from a file, does calculation and then displays that data in a table format on the screen. Then creates another file with those values:
Reads file: Beginningbalance.txt
Displays Data with calculation
Creates a file called "Newbalance.txt" with the following values:
111
251.41
222
402.00
With the way the code is written I can get it to create the file but it only displays one of the customers (111). I know that I need to create a loop but I am not sure how to build that. I tried creating another while loop and changing it to outFile but that was without success.
import java.io.*;
import java.util.Scanner;
import java.text.DecimalFormat;
public class Output {
public static void main(String[]args) throws IOException {
[Code] .....
View Replies
View Related
Feb 24, 2015
I am assigned with a project that will as the user for the amount of days they would like data entered, then loop asking them for these numbers. once it reaches the entered amount of days it will display a menu for which the user can enter the number they want on the list and it will display the data. the menu has 6 items. Total, Average, Determine if its a Drought, Flood or normal rainfall, highest of data entered, lowest of data entered, and 6 is to quit the program.
So far i have total and average working properly. Still looking at how to display drought, flood, and normal.
Main problems, i cannot get highest and lowest to display correct data.
Also when entering 6, or an invalid menu choice, neither "goodbye" or "invalid choice, choose again" gets printed. Rather the loop for entering data continues.
import java.util.Scanner;
public class RainAnalysis {
/*
* Project 1 This program will analyze the rainfall for the number of days a user inputs.
*/
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int numOfDays = 0;
double rainfallAmount = 0.0;
[Code] ....
Here is a sample output to show what happens when i put in 6 after the menu is displayed.
also i noticed that it does not say the correct day when displaying the lowest and highest rainfall. this is because i put count, i did not know what else to put in order to get the correct day.
how many days do you want to monitor rainfall?5
Enter the rainfall for day 1.01
Enter the rainfall for day 2.1
Enter the rainfall for day 36
Enter the rainfall for day 43
Enter the rainfall for day 51
Rainfall Data Display Menu:
1 - Display total rainfall.
2 - Display rain average for the period.
3 - Display if drought, flood, or normal conditions.
4 - Display the day and amount of the highest rainfall.
5 - Display the day and amount of the lowest rainfall.
6 - Quit the program.
Enter your choice:
4
Day5 has the highest rainfall with 6.0 inches.
Rainfall Data Display Menu:
1 - Display total rainfall.
2 - Display rain average for the period.
3 - Display if drought, flood, or normal conditions.
4 - Display the day and amount of the highest rainfall.
5 - Display the day and amount of the lowest rainfall.
6 - Quit the program.
Enter your choice:
5
Day5 has the lowest rainfall with 0.1 inches.
Rainfall Data Display Menu:
1 - Display total rainfall.
2 - Display rain average for the period.
3 - Display if drought, flood, or normal conditions.
4 - Display the day and amount of the highest rainfall.
5 - Display the day and amount of the lowest rainfall.
6 - Quit the program.
Enter your choice:
6
Enter the rainfall for day 6
View Replies
View Related
Mar 24, 2014
How to get used to program control statements. This is an attempt to write a program that returns the number of days between two dates. Sadly, it give incorrect values.
public class DaysBetweenDates {
public static boolean isLeapyear(int year) {//This method will determine if a year is a leap year or not
boolean isTrue=false;
if(year%4==0 && year%100!=0) isTrue=true;
else if(year%400==0) isTrue=true;
return isTrue;
[Code] ....
View Replies
View Related
Nov 23, 2014
So basically we have this question to do : Write a method dayNumber that determines the number of days in a year up to and including the current day. The method should have three int parameters: year, month, and day. If the value of any parameter is invalid, the method should print a warning message and return the value zero. The table gives some examples of the action of the method. Accept any non-negative year as being valid. You may want to assume the existence of a method numberOfDays that returns the number of days in a given month of a given year. And you should have a method call isLeapYear, if the user enter a year that is a leap year.
This is what I did so far:
class dayMonthYear {
public static void main(String[] args) {
System.out.println("Enter a year");
int year = In.getInt();
System.out.println("Enter the month for '1' to be January - '12' to be december");
[Code] ....
It works and compiles but my problem is that: let say I enter "12" for December and December has 31 days, so what my program will do since December has 31 days, it thinks each month has 31 days and add them up which will give me 372 when it's suppose to give me 365. How do I make it that it won't do that and that it will work if the year is a leap year too.
View Replies
View Related
Jan 22, 2015
I am writing a payroll program .The program generates random PPS numbers and then takes in users information and calculates the salary accordingly. I am using netbeans and my code is showing errors on line 18 and 42 ("cannot find symbol")on the code for grossPay(). The program seems to crash after a new PPS number is generated and will not run.
package sd_assg_2;
import java.util.Arrays;
import java.util.Random;
import javax.swing.JOptionPane;
public class SD_ASSG_2 {
public static void main(String[] args) {
String[] newPPs = getPPSno();
[Code] ....
View Replies
View Related
Jul 4, 2014
I am trying to make a program that get input value 1-200 from user. However I would like to make the program to show warning if the input number is not within the range of 1-200. In the end I would like to show the amount of number according to its interval (i.e less 50, 51-100 and so on) ....
import java.util.Scanner;
class test {
public static void main (String[] args) {
int number[]= new int[5];
int number2[]= new int[5];
int a=0,b=0,c=0,d=0,i=0;
[Code] .....
View Replies
View Related
Jun 9, 2014
I am trying to make a program to multiplies two numbers without using the "*" operator. My idea was to add x number y amount of times, which is the same as multiplication. I did this with a for loop, but zero is always returned as the answer. How can I fix this?
public class secondMult {
public static void main(String[] args){
System.out.println(multWithSum(4,5));
}
public static int multWithSum(int x, int y){
int sum = 0;
for(int i = 0; i==y;i++){
sum = sum + x;
}
return sum;
}
}
View Replies
View Related