Share
Explore BrainMass

Java

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

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 DayCare.java 2. Declare and intialize the two-dimension

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 java.io.BufferedReader; import java.io

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 {

Understanding how to declare and use variables in computer science homework.

How do you figure out how to declare a variable? How do you know what type of variable to use? What is the best way to name a variable and why? What are the differences between an integer variable and a floating point variable? When and why do data type conversions occur? What is the modulus operator? Write a short java state

Java (Command Line) Competency Checks

Java (Command Line) Competency Checks 1. Write, compile and run a standalone Java application that displays an output line on the console. 2. Write a simple Java program that incorporates at least three best practices for making your code readable and understandable by yourself and others. 3. Write, compile and run a Ja

Java Code & Class File

Java code with comments and class file Details: You need to write a program that calculates sales tax and total sale amount. The user should be presented with a menu listing four different products. Based upon their choice, the user enters the quantitly that they desire. The program will then calculate the Subtotal, Sales

Java Code and Class File

Details: You need to write a program that calculates sales tax and total sale amount. The user should be presented with a menu listing four different products. Based upon their choice, the user enters the quantity that they desire. The program will then calculate the Subtotal, Sales Tax Amount, and Total Sale Amount. The calc

I need assistance on java compilers

I need assistance with the following. There are Java compilers and interpreters. Write 1 page on compilers and interpreters (2-3 paragraphs on each topic). You must include the following: - Discuss the advantages and disadvantages of compilers and interpreters. - When would you use each? - Pick a problematic situation t

Linked List

Criterion Score 1. Declare a LinkedList that stores Strings 2. Add code that formats a String with the calculation's results 3. Store the formatted String into the LinkedList 4. Display the elements in the LinkedList when the user ends input 5. Insure that the FutureValueApp class compiles 6. Include a text

CustomerType enum and CustomerTypeApp class using NetBean 7.2

USING NETBEAN 7.2 Criterion 1. CustomerType enumeration contains constants representing 3 customer types: retail, trade and college 2. CustomerType contains getDiscount method that returns the appropriate discount for each customer type: 10% for retail, 30% for trade and 20% for college 3. CustomerType enumeration contain

Java Programming: SchoolTextBook Class

Create a class titled SchoolTextBook that contains fields for the author, title, page count, ISBN, and price. This SchoolTextBook class will also provide setter and getter methods for all fields. Save this class in a file titled SchoolTextBook.java. Write an application with an array that holds 5 instances of the SchoolTextBo