Class Diagram For Application
Feb 13, 2015
I'm having trouble doing out a class diagram for an app I'm trying to create.The app is a quiz app for students to use in their study. The following objects I have to put in the class diagram are:
Basic Questions attributes:
questionText
correctAnswer
mark (representing the mark awarded for a correct answer)
Answer (representing the answer entered by the user).
Multiple choice question attributes:
questionText
correctAnswer
mark (representing the mark awarded for a correct answer)
option a, option b and option c (representing each of the possible answer)
answer (representing the answer chosen by the user)
Essay Question attributes:
questionText
correctAnswer
mark (representing the mark awarded for a correct answer)
answer (representing the text entered by the user)
maxWordCount (representing the maximum word count for the essay)
Picture Question attributes:
questionText
correctAnswer
answer (representing the text entered by the user)
imageName (representing the image to be displayed with the question)
View Replies
ADVERTISEMENT
Dec 16, 2014
I want to plot a scatter diagram and I need to do this as soon as possible.
The graph is to make use of JComponent only.
The diagram title should show the Title: Graph of y on x
The scattergram should show points (x,y) of Npoints.
The diagram should calculate and draw a "line of best fit" for the data.
The diagram should also state the equation for the line of best fit.
I have installed eclipse and is it possible to get a code to run this?
View Replies
View Related
May 14, 2014
draw a sequential diagram using java.with out using any other tool or plugins.
View Replies
View Related
Apr 15, 2015
I have my paint application, i use the following mouse event to draw my shapes (mousePressed, mouseReleased, mouseDragged). Now after the user paint a circle for example, he must be able to drag the shape; to be able to do this. i think i must again implement the different mouse Events. I have done it and the drag is not working. How can i achieve this. can we implement multiple (mousePressed, mouseReleased, mouseDragged) in the same java class??
View Replies
View Related
Jun 23, 2014
I am trying to put together an encryption/decryption application that will essentially accept a sentence that is submitted, and spit out the encrypted version and then switch it back to the correct sentence. I have been told to nest my information in the class (rather than the main), but am having difficulty actually understanding how to do this. The error that Eclipse is throwing me is also that it "could not find the main class." Here is my code:
import java.util.Arrays;
import java.util.Random;
public class encryptingWords {
public static void main(String[] args) {
final int ALPHASIZE = 26;
final char[] Lalpha =
[Code] .....
View Replies
View Related
Sep 3, 2014
I currently use Eclipse to maintain our Java application. I recently upgraded from Java 6 to Java 7. I updated my Eclipse projects to use the Java 7 .jar files. I can run the application from Eclipse via the Run Configuration.
I can also run the Ant build and it completes successfully. When I install the application on my desktop, I receive the "Java Virtual Machine Launcher: Could not find main class..." error. My CLASSPATH is set to ".".
View Replies
View Related
Nov 17, 2014
convert or move standalone java thread application into Tomcat server container for accessing its JNDI services? Also is it possible to schedule this thread application in Tomcat server? is it possible to keep this app in tomcat as web application and schedule in window's scheduler.
View Replies
View Related
Mar 11, 2014
I am new to work on JNLP program. I have created a SWING program, JNLP file when i deploy the ear file i am getting 404 error. Please find the steps in details.
1.Created a dynamic web project JWStartProject in eclipse
2.Create a HelloWorld.java class under default package.
import javax.swing.*;
public class HelloWorld extends JFrame {
private static final long serialVersionUID = 4968624166243565348L;
private JLabel label = new JLabel("Hello Java Web START!");
public HelloWorld() {
super("Jave Web Start Example");
this.setSize(350, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
this.setLayout(null);
[Code] ....
Now I exported this project as JWStartProject.war contains following code.
Created Server in Websphere Admin console
Deployed this war file under the server and started.
I have added MIME types also.
I am unable to launch the application. I am getting 404 errors. May I know where I went wrong?
View Replies
View Related
Mar 5, 2015
How do you declare methods for a class within the class whilst objects of the class are declared else where?
Say for instance, I have a main class Wall, and another class called Clock, and because they are both GUI based, I want to put a Clock on the Wall, so I have declared an instance object of Clock in the Wall class (Wall extends JFrame, and Clock extends JPanel).
I now want to have methods such as setClock, resetClock in the Clock class, but im having trouble in being able to refer to the Clock object thats been declared in the Wall class.
Is this possible? Or am I trying to do something thats not possible? Or maybe I've missed something really obvious?
View Replies
View Related
Mar 1, 2015
Does child class gets a copy of the methods and variables of parent class?
public class test1 {
public static void main(String a[]) {
Child c = new Child();
c.print();
[Code] ....
why is the output 1?
View Replies
View Related
Feb 18, 2014
Class UserAssessBean{
private String username;
private int userid;
private ArrayList<ModuleBean> module;
--{get/set}--
[Code] ....
How can i access the getters/setters of module bean, when it was returned as array list in UserAssessBean?
View Replies
View Related
May 28, 2014
Regarding the lifecycle of servlet , in headfirst servlet i can find :
You normally will NOT override the service() method, so the one from HttpServlet will run. The service() method figures out which HTTP method (GET, POST, etc.) is in the request, and invokes the matching doGet() or doPost() method. The doGet() and doPost() inside HttpServlet don’t do anything, so you have to override one or both. This thread dies (or is put back in a Container-managed pool) when service() completes.
How can I call the doGet method of the subclass from the superclass. i am not getting this .
View Replies
View Related
Apr 14, 2015
I have a quick polymorphism question. I have a parent class and a sub class that extends the parent class. I then declare an array of parent class but instantiate an index to the sub class using polymorphism. Do I have to have all the same methods in the child class that I do in the parent class? Here is an example of what I mean.
public class ParentClass
{
public ParentClass(....){ }
public String doSomething(){ }
}
public class ChildClass extends ParentClass
{
public ChildClass(....)
[Code] ....
Is polymorphism similar to interfaces where the child class needs all the same methods?
View Replies
View Related
Feb 4, 2015
I want to know is there any way we can call parent class method using child class object without using super keyword in class B in the following program like we can do in c++ by using scoop resolution operator
class A{
public void hello(){
System.out.println("hello");
}
}
class B extends A{
public void hello(){
//super.hello();
System.out.println("hello1");
[code]....
View Replies
View Related
Jul 14, 2014
i want to write a class in such a way that i should get the current execution time of another class which is running. I searched in net but it shows only how to calculate the time duration of the current class which is running. But as per my way, i need the execution time of one class from another class. How to do this ?
View Replies
View Related
Aug 28, 2014
can we pass private final class object to another class constructor?
View Replies
View Related
Jul 5, 2014
I am working on a program that simulates a bug moving along a horizontal line, My code works correctly when I test it in it's own class but when I tried testing my constructor and methods in a test class I received an error saying, "package stinkBug does not exist" on lines with my methods. However, stinkbug is not a package.
Java Code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
[code]....
View Replies
View Related
Jan 8, 2014
I've 3 classes.
1. Circle
2. GetInputFromUser
3. testCircle
package ABC;
public class Circle {
private double radius;
public double getRadius() {
return radius;
[Code] .....
In the testCircle class, in the line: getRadius = ui1.GetInput();
It's showing the error: The method GetInput(float) in the type GetInputFromUser is not applicable for the arguments ()
And when I do: getRadius = ui1.GetInput(rad);
It's showing the error: rad cannot be resolved
View Replies
View Related
Apr 22, 2015
How to create object for "class B" and call the "function_B" from other different class D where class D has no connection with class A? Here is my program.
public class A(){
void print(){}
}
class B{
void function_B(){}
}
class C{
void function_C(){}
}
Here, A, B, C are in the same package. But class D is in different package.
View Replies
View Related
Aug 1, 2014
So i declared a class in main class but it seems there's error when i compile:
constructor xx in class xx cannot applied to given types
This is my java class:
public class trainer extends person{
String classType;
public trainer(String name, String gender, String address, int id, String classType) {
super(name,gender,address,id);
this.classType=classType;
[Code] ....
And this is the way i declared in main class:
trainer tr = new trainer();
And what i want to do is:
tr.toString();
View Replies
View Related
Nov 16, 2014
I am a beginner here at JAVA and I am trying to program a Gratuity Calculator using both interface class and object class but it keeps on compiling with errors saying "cannot find symbol".I tried everything to fix it but it just keeps on stating symbol.
[CODE]
public class GratuityCalculator extends JFrame
{
/* declarations */
// color objects
Color black = new Color(0, 0, 0);
Color white = new Color(255, 255, 255);
Color light_gray = new Color(192, 192, 192);
[code]....
View Replies
View Related
Jul 4, 2014
I have never seen a class defined under another class ....
class pe{
static class pqsort implements Comparator<integer>
public into compare(Integer one,Integer two)
return two-one;
}
}
First I want to know how class pqsort is defined under class pe ....
And how the comparator used in this example is sorting elements in reverse order
View Replies
View Related
Feb 14, 2014
I was doing coding exercise from a book ('OCP Java SE 6 - Practice Exams' by Kathy Sierra and Bert Bates). I came to a question that told to demonstrate the difference between 'default' and 'protected' access rules by creating/making a directory structure and putting a couple of classes in different packages.
For this, I made a total of four classes, out of which, three classes are-Car, TestingCars, CarDimensions. (The fourth is not yet used in testing code till now, so, I am giving only the other three classes.) Their coding is given below.
Out of these classes, the classes- TestingCars and Car - are in a directory (say, FolderName). And, the class- CarDimensions is in FolderName's sub-folder.
The class 'CarDimensions' is public (and its components too are public). And, I am testing all the classes from the class- 'TestingCars'. But, this class (TestingCars) is not able to find the public class- 'CarDimensions' which is in its sub-folder and gives two 'Cannot find symbol' errors citing the class-CarDimensions. Also, If all three classes are put in one single directory, the programs work, without any error.
Coding:
Class TestingCars:class TestingCars {
public static void main(String[] args) {
Car c = new Car();
c.setType("FourWheeler");
[Code]....
I could not find why the public class- CarDimensions- is not getting found by the TestingCars class.
View Replies
View Related
Mar 31, 2014
I want to write an app that declares a class Person(String name, int age), and an Account class, Account(int code, double balance).But, additionally, every Person has at most 3 accounts, and each account has a Peron associated with it.
my code so far...
public class Person {
private String name;
private int age;
private Account[] accounts;
private int numOfAccounts;
public Person(String name,int age){
this.name=name;
[code]....
My problem is:When I make data input for a person, and additionally I want to read data for the account(s) that this rerson has, what code should I write to create a new Account object as account[numOfAccounts].And, what is the code to assign an owner to a new created Account object?
There exists a relationship between the two classes, but I cannot find the way to implement this relation....
View Replies
View Related
Jan 30, 2014
Write a class named Calculator add four methods to that class:
add(int a, int b)
sub(int a, int b)
mul(int a, int b)
div(int a, int b)
Then write a Tester class with main function and show the use of the methods in Calculator class..
View Replies
View Related
Apr 1, 2015
public class Sphere {
public double diameter;
public double volume;
public double area;
public double fourThirds = 4/3;
public Sphere(double someDiameter){
someDiameter = diameter;
[Code] ....
I am trying to get this code so that I only enter the diameter once in the sphere object1 = new Sphere(4); but I can't get it to work right. I can get the diameter to work with the calculate volume and area methods but that's it.
View Replies
View Related