Explore BrainMass


Write a student class in Java that implements the Comparable interface.

Write a student class in Java that implements the Comparable interface. The class has: - Two instance variables studentId (String) and gpa (double). StudentId would contain six-digit Student Id, and the value of GPA is between 0.00 and 4.00. - Two constructors with the following headers: --> public Student(String studentId,

Solving: JAVA Questions

- The linked list that follows represents a stack. After we push the player (5, Joe, Sonic) onto the stack, what are first and last items on the stack? (7,Ajay, NFL) -> (3, Sarah, Mario) -> (9, Jin, Golf) -> null head (7, Ajay, NFL0 and (9, Jin, Golf) (5, Joe, Sonic) and (9, Jin, Golf) (3, Sarah, Mario) and (5, Joe

Java Array Coding

3- In a two-dimensional array, every row must have the same number of columns. true or false 5- How do you access the element of array a located at row 2 and column 4? 9- An ArrayList can be returned by a method. True or False 11-Is is possible to declare and instantiate an ArrayList of a user-defined class type. True o

Java: flow of control looping

1. What is the output of this code sequence? (The user successively enters 3, 5, and -1.) System.out.print( "Enter an int > " ); int i = scan.nextInt( ); while ( i !=-1 ) { System.out.println( "Hello" ); System.out.print( " Enter an int > " ); i = scan.nextint ( ); } 2. what are the values of i and product af

Java Array Manipulation With & Without Java 3rd Party Libraries

Please help to create two separate Java codes resulting in the same output (one using Apache Commons library and one using the standard Java methods). The program should count all people with the same last name and then change the last name to Doe. See the attachments. When using the Apache Commons library it has been s

Explain and fix errors for Java code

You coded the following in the int [ ] a = { 1, 2, 3 ); System.out.println ( a ); The code compiles properly and runs, but the result is not what you expected; the output is similar to the following: [I@f0326267 Explain what the problem is how to fix it.

Trouble Shooting Java Code

You coded the following in the class: ArrayList <String> a = new ArrayList<String> ( ); a. add ("Cloudy"); a. add ("Snowy"); a. add("Cloudy"); System.out.println ( "Weather is " + a. get (3 ) ); // line 14 The code compiles properly, but when you run, you get the following output: Exception in thread "main" jav

Trouble Shooting a Java Program

You coded the following on line 10 of the class Color c = Color.Blue; //line 10 When you compile, you get the following message: Cannot find symbol Color C =; //line 10 Symbol: variable blue Location Class Color 1 error Explain what the problem is and how to fix it.

PHP, PHPUnit, XPath

Function testCountListElements should simply retrieve an array of all list (html tag li) elements on the page and assert that their total count is three. Utilize an XPath expression for retrieving the elements on the page and assertCount() when doing your assertion. XPath expressions starting with a double slash (ie: //) will lo

Java code - college members classes

Im studying for my finals in Java programming 1. Im struggling with the attached practice question. I need to write a code for this example. Can you please ENSURE you add COMMENTS to the code so I can understand how it works. AND also following exactly the instructions in the attachment PLEASE. The File name is task2 and NO

Finding Error in the Java Script

Given the following class definitions: Public abstract class A2{ private int x; public A2 (int a) { this.x=a; } public int getX(){ return this.x; } public abstract double sameInfo(); } public class B2 extends A2 { private int y; public B2 (int a, int b) { super(a); this.y = b; } public int getY () { return

Coding in Java language

For this task you will create a Subject class, whose instances will represent the subjects for study at a university. A subject will have a name, just a String, and a subject code, which is a six-character String. The first three characters of a subject code are alphabetic and the last three are numeric. The first three characte

java: toString Methods Create the employee, manager and executive classes.

Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named department, of type String. Supply a method toString that prints the manager's name, department, and salary. Make a class Executive inherit from Manager. Supply appropriate toString methods for all clas

what is happening in the java code

QUESTION 1 public abstract class Account{ public abstract boolean open(double); } public class Checking extends Account{ public boolean open (double bal){ } } In the above code, what happens if open() is not declared in each subclass of Account? Question 2 public

Writing methods that requires multiple parameters and return the value

1. Methods that require multiple parameters. The program prompts the user for two numeric values. Both values should be passed to methods named calculateSum(), calculateDifference(), and calculateProduct(). The methods compute the sum of the two values, the difference between the two values, and the product of the two values. Ea

Complex GUI Exercise

Design an application to take and process a pizza order. The user should be able to make pizza order choices from listboxes, and the application should display the order price. One of the listboxes should allow a user to select pizza size under the following criteria: small with the base price of $7, medium with the base price o

Using Java to Determine Weekly Rate

The program should allow users to enter the age of the child and the number of days per week stays. Need to write the input statements and the code that initializes the two-dimensional array, determines the weekly rate and prints the weekly rate. 1. Open the source code 2. Declare and intialize the two-dimension

Java: Program to remove comma from the number

Write a Java program that reads a number between 1,000 and 999,999 from the user, where the user enters a comma in the input. Then it prints the number without a comma. Below is a sample dialog. Please enter an integer between 1,000 and 999,999: 23,456 23456 Hint: Read the input as a string. Measure the length of the stri

Editing a Java Program

Please help with this java program (that is what I have so far its not displaying the medal count). public class Medals{ public static void main(String[] args){ final int COUNTRIES = 7; final int MEDALS = 3; String[]country = { "CANADA", "CHINA","GERMANY", "COREA", "JAPAN", "RUSSIA" } ; int[][]count = {{

Java Arraylist

I am still sorting through this chapter on arrays and ran into another exercise that I do not understand. If someone could please help a struggling single mom figure this out it would be much appriciated. This program is in Java. The following code creates a simple ArrayList: import; import

Simple Commission Calculation Program

Modify the Week Two Java application using Java NetBeans IDE to meet these additional and changed business requirements: - The company has recently changed its total annual compensation policy to improve sales. - A salesperson will continue to earn a fixed salary of $55,300. The current sales target for every salesperson is

Java programming - Person Runner

Using the Person and PersonRunner classes below, execute the main method in PersonRunner. Why does the program end abnormally? Comment out the first two lines and run the program again. Why does the reference to p3 cause Frank's name to be printed when we set Frank's name with the p2 reference? public class PersonRunner {