473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

interactive java program

CODE]
the project is to ask the user to enter three nonnegative intergers to
represent a time amount measured in hours, minutes, and seconds and then prints the equivalent time in seconds. Use three lines for input and one linf for output. The user's responsers should be on the same line as the prompts. One the output line use a complete and corret sentence that echoes the input and shows the equivalent total time in seconds.CODE]

[
Expand|Select|Wrap|Line Numbers
  1. B]the total time in seconds.[/Output should be exactly like this:
  2. The time interval 0 hours hours (s), 1 minute (s), and 0 seconds (s) is equivalent to 60 second (s).[/b]
Expand|Select|Wrap|Line Numbers
  1. Have input any special input situtations
Expand|Select|Wrap|Line Numbers
  1. Design the program with separate sections for input, annalysis, and output; use variables to hold the number of hours, minutes, and seconds.
Expand|Select|Wrap|Line Numbers
  1. Includeprint outs of at least 11 trial runs. Donot overlook extreme, marginal, and special cases of input. What happens if it crashes?
  2.  
  3. My instructor sugged we write & run a preliminary on an easy topic, here is mine but I am having trouble revising iit.
  4.  
  5. Please help!

Here is mine start:Please me get it into the type of program that is required. Thx!

//DivisionTester.java
//Purpose: This is an interactive program to test how interger division works.
import java.util.scanner;

public class DivisionTester
{
//
public static void main (String [] args)

{
//need a comment for main method

int numerator; // the user's numerator for the division
int denominator;// the user's denominator for the division
int quotient; // the calculated quotient of the two input values
scanner scan = newScanner(System.in);

//get the input values
system.out.print("Enter the numerator (as integer); ");
numerator = scan.nextInt();

system.out.print("Enter the denominator (as a nonzero number); ");
denominator = scan.nextInt();;

//calculate the quotient
quotient = r;

//report the quotient

system.out.println(numerator + "/" + denominator + " = ' + quotient);

} // end of main method
}// end of DivisionTester class
Oct 3 '06 #1
1 2718
r035198x
13,262 8TB
CODE] represent a time amount measured in hours, minutes, and seconds and then prints the equivalent time in seconds. Use three lines for input and one linf for output. The user's responsers should be on the same line as the prompts. One the output line use a complete and corret sentence that echoes the input and shows the equivalent total time in seconds.CODE]

[
Expand|Select|Wrap|Line Numbers
  1. B]the total time in seconds.[/Output should be exactly like this:
  2. The time interval 0 hours hours (s), 1 minute (s), and 0 seconds (s) is equivalent to 60 second (s).[/b]
Expand|Select|Wrap|Line Numbers
  1. Have input any special input situtations
Expand|Select|Wrap|Line Numbers
  1. Design the program with separate sections for input, annalysis, and output; use variables to hold the number of hours, minutes, and seconds.
Expand|Select|Wrap|Line Numbers
  1. Includeprint outs of at least 11 trial runs. Donot overlook extreme, marginal, and special cases of input. What happens if it crashes?
  2.  
  3. My instructor sugged we write & run a preliminary on an easy topic, here is mine but I am having trouble revising iit.
  4.  
  5. Please help!

Here is mine start:Please me get it into the type of program that is required. Thx!

//DivisionTester.java
//Purpose: This is an interactive program to test how interger division works.
import java.util.scanner;

public class DivisionTester
{
//
public static void main (String [] args)

{
//need a comment for main method

int numerator; // the user's numerator for the division
int denominator;// the user's denominator for the division
int quotient; // the calculated quotient of the two input values
scanner scan = newScanner(System.in);

//get the input values
system.out.print("Enter the numerator (as integer); ");
numerator = scan.nextInt();

system.out.print("Enter the denominator (as a nonzero number); ");
denominator = scan.nextInt();;

//calculate the quotient
quotient = r;

//report the quotient

system.out.println(numerator + "/" + denominator + " = ' + quotient);

} // end of main method
}// end of DivisionTester class
1. Use code tags for posting code.
2. Do not use code tags for text that is not code
3. Java is case sensitive scanner != Scanner, system != System etc.
4. Variables have to be declared before they are used, thus quotient = r; will not compile
5. Division produces non integral results. Use double not int to represent the quotient.
Expand|Select|Wrap|Line Numbers
  1. double r = numerator / (double)denominator;
6. Please make these corrections and post if have further problems
Oct 3 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Steve Menard | last post by:
I have a strange problem with Python command-line interactive mode. Problem has been observed on every 2.3 version where it was tested, from 2.3 alpha to 2.3.4 Test is run on windows XP and 2000...
147
by: Sateesh | last post by:
Hi, I am a beginner in Python, and am wondering what is it about the indentation in Python, without which python scripts do not work properly. Why can't the indentation not so strict so as to give...
20
by: Joe | last post by:
When you run "python -i scriptname.py" after the script completes you left at the interactive command prompt. Is there a way to have this occur from a running program? In other words can I...
5
by: Eckhoff, Michael A | last post by:
Hello, I failed to locate a list for pygtk, so I thought I'd ask my question here. Is it possible to write CGI scripts that bring up a GUI (as in GTK+, QT, Tk, ...) or an openGL display that is...
4
by: doltharz | last post by:
Someone can point me to some good tutorial on building realtime multiuser interactive web pages? I prefer ASP/HTML but if there is no way, i'm open to Flash Java and Activex. By the way i prefer...
22
by: SeeBelow | last post by:
Is there any way, in C, of interacting with a running program, but still using code that is portable, at least between linux and Windows? By "interacting" it could be something as simple as...
2
by: Allan Adler | last post by:
In C, I can execute system("gs gleep.ps"); and have C run a ghostscript program gleep.ps, which might ask for user input and, when it gets it, take some actions and report back to the C...
10
by: notejam | last post by:
I am trying to get started with a interactive version of Python for windows and need some help. I have played with the tutorial, and now want to write a program. In basic language, I could write...
3
by: R. Bernstein | last post by:
The next release of pydb will have the ability to go into ipython from inside the debugger. Sort of like how in ruby-debug you can go into irb :-) For ipython, this can be done pretty simply;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.