BlueJ Platform - Conversion Program From Cm To Inches And Inches To Cm

Jan 20, 2015

I am coding for the first time using the simplified BlueJ platform. I am trying to write a simple conversion program from cm to inches and inches to cm.

Here is my code so far (I also have the textIO file linked to it):
 
public class UnitConverter {
public static void main(String[] args){
int inchesTocentimetres, centimetresToinches, exitApplication;
int choice;
double result;
 
 [Code] .....

View Replies


ADVERTISEMENT

Program For Weight Conversion GUI

Apr 21, 2015

I'm working on a Weight Conversion program. The code I have for the program is:

import java.util.*;
import java.awt.*;
import javax.swing.*;
public class Frame4a implements ActionListener {
public static void main(String[] args) {
JFrame f = new JFrame("Weight converter");
JPanel P = new JPanel(); // Make a JPanel;

[Code] .....

The errors I'm getting are:

Frame4a.java:33: error: class, interface, or enum expected
public void actionPerformed(ActionEvent e){
^
Frame4a.java:37: error: class, interface, or enum expected
double kp= Double.parseDouble(strkilo);

[Code] .....

View Replies View Related

Program Conversion Int To Double

Apr 20, 2015

I am working with a java program that uses binary and sequential search. i have those two methods working. In the program i also need to return the price of parallel arrays. This is my code so far:inventory class:

//FileName: InventoryData.java
//Prog: Brock Paston
//Purp: To load and search through arrays with binary and sequnetial search.
package stu.paston.program6;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Scanner;

[code]....

View Replies View Related

Time Unit Conversion Program

Feb 8, 2015

So, here is the question I have been working on: Write a java class named Time that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (For example the elapsed time is 9630 seconds, and then the output is 2:40:30 ).Hint: an hour has 3600 seconds and a minute has 60 seconds. Use Scanner class for reading the input.

Here is my code:

import java.util.Scanner;
public class Time {
public static void main(String[] args) {
Scanner scan= new Scanner(System.in);
System.out.println("Enter the elapsed time in seconds:");
int totalseconds= scan.nextInt();

[Code] .....

Now, I know I am supposed to use the remainder operator to figure out the time in minutes and seconds, but the hours has be a little confused. Right now this code compiles but gives me an exception.

View Replies View Related

Write A Program To Print Out Fahrenheit-Celsius Conversion Table?

Oct 14, 2014

This is my program

import java.util.Scanner;
import java.text.DecimalFormat;
public class Lab6 {
public static void main(String[] args) {
int F;
double C = 0;

[Code] ......

output

0 1 2 3 4 5 6 7 8 9
0 degree Fahrenheit equal to :-00.00 degree Celsius
1 degree Fahrenheit equal to :-00.00 degree Celsius
2 degree Fahrenheit equal to :-00.00 degree Celsius
3 degree Fahrenheit equal to :-00.00 degree Celsius
4 degree Fahrenheit equal to :-00.00 degree Celsius
5 degree Fahrenheit equal to :-00.00 degree Celsius
6 degree Fahrenheit equal to :-00.00 degree Celsius
7 degree Fahrenheit equal to :-00.00 degree Celsius
8 degree Fahrenheit equal to :-00.00 degree Celsius
9 degree Fahrenheit equal to :-00.00 degree Celsius

I don't know why the program is not calculating the C degree ?

View Replies View Related

RMI With Doing Calculations Across A Server / Client Platform

Apr 6, 2014

It's an RMI program that has to be able to return the mean, mode and median of a set of numbers.It's composed of 4 classes; a client, an implementation class (with the math), an Interface, and a server class.

import java.rmi.NotBoundException;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.io.*;
 
[code]....

View Replies View Related

How To Add Javadocs For BlueJ

Oct 7, 2014

I am new to BlueJ. I have to add Javadocs every time I finish the program, but I see a folder named "doc" .

What's that folder ? Is it Javadocs?

I see :ToolsProject Documentation => regenerate??

View Replies View Related

Unable To Keep Platform Object Within Applet Window?

Jun 12, 2014

I created a simple java game in which i have to keep the ball up with a platform, similar to the game brick breaker. Everything works great. I am using keyListener to move the platform left and right. My only problems is that I am unable to keep the platform in bounds of the applet window. I know Its something to do with my logic in the update method of my Platform class but I'm stumped. Here are the 3 classes:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

[Code].....

View Replies View Related

NoClassDefFoundError With Java Standard Platform Class?

Feb 18, 2015

I am facing NoClassDefFoundError with one of the java standard platform class (java.text.DigitList$1)

java.text.DigitList class is part of rt.jar so it should not create any issue as such.

I am using Java 1.6.0_06

StackTrace:
Unhandled exception java.lang.NoClassDefFoundError: java/text/DigitList$1
at java.text.DigitList.shouldRoundUp(DigitList.java:4 11)
at java.text.DigitList.round(DigitList.java:363)
at java.text.DigitList.set(DigitList.java:351)
at java.text.DigitList.set(DigitList.java:272)
at java.text.DecimalFormat.format(DecimalFormat.java: 584)
at java.text.DecimalFormat.format(DecimalFormat.java: 507)
at java.text.NumberFormat.format(NumberFormat.java:26 9)

View Replies View Related

JAVA Platform Game Jumping And Collision

Sep 16, 2014

i have problem in what comes to jumping because in what i have now mario jumps with the key lsitener, key pressed up arrow and it jumps smooth but when im trying to make it fall down he appears immediatly at ground and it doesnt simulate the fall as it should be.

import java.awt.BorderLayout;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import java.awt.EventQueue;

[code]....

The other problem is that i dont really know how to detect collisions if there is a method that makes easier this proceso and how to make the map to continue and repeat so mario could continue walking,

View Replies View Related

Calculating Factorials Using BlueJ

Oct 7, 2014

I am trying to calculate factorials using BlueJ. All of my factorials calculate correctly, I am just having an issue with something the instructor asked of us. She asked us to force the loop to stop when the user inputs "Calculate the factorial of 0", and not give any print.

So far I have my for loop with the correct conditions, I am just really confused as to how to make an if statement to stop the code when the input is 0.

View Replies View Related

Build A Calendar In BlueJ

May 25, 2014

i have a problem, i need build a calender in BlueJ. The program need to found if I put this one year have to give me the full schedule but only the first semester.

View Replies View Related

BlueJ Error Code

Apr 6, 2014

the system I am using is blue jay and java. my problem is that I have this error message pop up whenever I try to compile any of my 6 classes. Three of the classes are cities, 3 others are shops, and the final one is a inventory called Player. The following is the error code that appears when I try to compile class THshopB or class CityB.

method run in class CityB cannot be applied to given types;required: Player; found: no arguments; reason: actual and formal argument lists differ in length

A similar error occurs for the rest of my City and THshop classes,except it replaces the class CityB with CityA and occurs in class THshopA, replaces CityB with CityC when occurring in class THshopC.The public methods of CityB and THshopB are shown below, as I believe that something is wrong with the public method of one or the other. I have the code [CItyB.run();}] inside of class THshopB, and run is the part that gets the red highlight error described above.THshopB public method

[ public static void shop(Player inventory){
CityB.run();}]
CityB public method
[ public static void run(Player inventory){
THshopB.shop(inventory);]

All of my THshop classes are written in the same format, and all of my City classes are written in the same format,

View Replies View Related

BlueJ (double Input)

Jun 21, 2014

I typed the following program using BlueJ

import static java.lang.System.out;
import java.util.Scanner;
import javax.swing.JFrame;
public class Main {
public static void main (String args[]) {
Scanner read = new Scanner (System.in);
out.print ("> ");
double num = read.nextDouble();
out.println (num);
}
}

When I compile the code it gives me no errors; however when I run the program and write a floating point number it gives me the following message:

java.util.InputMismatchException: null (in java.util.Scanner)

I used to use an online compiler and the nextDouble() method worked perfectly there.

View Replies View Related

Difference Between Terms - Architecture Neutral And Platform Independent

Aug 12, 2014

I have just started learning Java from a local teacher, this teacher said that the Architecture Neutral refers to Hardware while Platform Independent refers to Operating System, but I found a link to a White Paper by James Gosling. The chapter 4 of this White Paper mentions about both binary code format that is independent of hardware architecture and operating system interfaces, but the main point to be noted is that he has put both under the heading Architecture Neutral. Does it mean that the original buzz word is Architecture Neutral, which includes both hardware and operating system independence?

View Replies View Related

Swing/AWT/SWT :: How To Run Multiple Frames In BlueJ

May 27, 2014

I've been doing a course with a heavy focus on applets and AWT using BlueJ. I've branched out and learn to convert my applets to applications. I can successfully use frames to do similar things to applets (in BlueJ's applet viewer) but I can not seem to run more than application at a time (unlike applets where I could run several at the same time).

Below is a simple Hello World program I wrote. When I re-run main() it closes the original and starts again. (I'm aiming to explore the java.net.* libraries and for testing would like to use more than one frame at a time which can communicate to each over via sockets).

import java.awt.*;
import java.awt.event.*;
public class HelloWorld extends Frame implements WindowListener {
public static void main (String[] args) {
HelloWorld app = new HelloWorld();
app.setSize(500,500);

[code]....

View Replies View Related

BlueJ - Creating New Variable From Within A Method

Mar 29, 2014

I am using blueJ as my java editor.

If I have a method that creates a new variable (the name of which is a string argument for the method). Can I get that variable to appear in the workspace in the variables pane?

So instead of just using return to output the variable how do I get in that variables pane?

View Replies View Related

Mirror Image In BlueJ (Java)

Sep 18, 2014

I have to mirror an image in BlueJay (java)

I have the following code, but it is missing a little bit. My instructor gave me a hint. He said that i have to use the setValue() and getValue() methods, but i'm still confused..

This code only return a black image with the same compositions as the image I want to mirror.

public Image mirror()
{
Image mirrorImage;
mirrorImage = new Image(foto.getWidth(), foto.getHeight(), "spejling");  
for(int i = 0; i < foto.getWidth(); i++)

[Code] ....

View Replies View Related

How To Display SWF Files In Java Code JEditorPane Using Eclipse Platform

Apr 28, 2014

Here attached my java code am trying to display .swf or .fla files from this code but am not able to retrieve .swf or .fla files.

View Replies View Related

BlueJ - Generating Multicoloured Brick Wall

Nov 5, 2014

I'm trying to generate a multicoloured brick wall as part of an assignment using BlueJ.

According to the instructions we've been given, once the wall is set up and we invoke the draw() method, if we invoke the toggleMultiColoured method the bricks will go from being all read to a mix of 6 different colours...

...When I invoke the toggleMultiColoured method, however, the wall I generate is still red.

Here's the source code for the BrickWall class I wrote:

Java Code:

public class BrickWall
{
private int bWidth;
private int bHeight;
private int numRows;
private int rowLength;
private ArrayList<String> colors;
private ArrayList<Rectangle> bricks;

[Code] .....

View Replies View Related

Counting Scoreboard - How Many Times A Ball Hits Moving Platform In Pong

May 9, 2014

I need to make a scoreboard that can count how many times a ball hits a moving platform in pong and have no clue how to approach this.

View Replies View Related

Swing/AWT/SWT :: Printing JTable - Java (TM) Platform SE Binary Has Stopped Working

Nov 19, 2014

I am getting the following message when trying to print a JTable.

"Java(TM) platform SE binary has stopped working"

Here is the code:

try {
MessageFormat headerFormat = new MessageFormat("Page {0}");
MessageFormat footerFormat = new MessageFormat("- {0} -");
table.print(JTable.PrintMode.FIT_WIDTH, headerFormat, footerFormat);
} catch (java.awt.print.PrinterException pe) {
System.err.println("Error printing: " + pe.getMessage());
}

View Replies View Related

Checkerboard Using 2D Arrays And Object Oriented Programming In BlueJ

Apr 23, 2014

Driver:

*initiating theGrid[][]*
public Zhang()
{
con.setLayout(new FlowLayout());
for (int xDimension = 0; xDimension<theGrid.length; xDimension++)

[Code] ....

All I'm getting as a blank screen and I've searched for what to put into object oriented code to make the image show up how to program using 2d arrays. I don't get any error messages (which is good I suppose) but how to make the image show up because I have stuff under the graphics and draw methods, did I do something wrong where initializing the array?

View Replies View Related

JSP :: Conversion Of HTML?

Feb 2, 2015

I have requirement to convert the HTML to JSP.

purpose: From the mobile i will get the HTML content and need the change content so need to convert html to JSP.

View Replies View Related

Conversion From Double To Int?

Nov 30, 2014

I'm having some trouble with a code I am writing for class. I had an 2 errors like this before this one and fixed it by changing int avgRe, avgMiles =0; to double. Now I am getting this error and am stuck on what I need to change. Here is the code:

import java.io.*;
import java.util.*;
import java.text.*;
 public class Reimbursement_3_09 {
 static Toolkit tools = new Toolkit();
 public static void main (String [] args) throws Exception {
 
[Code] ....

This is my error:

[code=Java]
Reimbursement_3_09.java:33: error: incompatible types: possible lossy conversion from double to int
summary (outFile, totalAmount, ctrMiles, ctrMilesgt0, avgRe, avgMiles);
^
Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error

View Replies View Related

Int To BigInteger Conversion?

Oct 13, 2005

How to convert an 'int' to BigInteger.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved