# Java

Need Help in Java Assignment?
We provide help for students all over the world in Java Assignment.

Items 1 to 10 of 11 total

per page
Page:
1. 1
2. 2

Grid  List

1. ## Stack to print numbers in other bases Java Program

\$5.00

Stack to print numbers in other bases Java Program

A stack can be used to print numbers in other bases (multibase output).
Example:
(Base8) 2810 = 3 * 81Â + 4 * 80 = 348
(Base4) 7210 = 1 * 43 + 0 * 42 + 2 * 41 + 0 * 4 = 10204
(Base2) 5310 = 1 * 25 + 1*24 + 0 * 23 + 1 * 22 + 0 * 21 + 1 * 20 = 1101012

Write a Java program using stacks (linked lists) that takes 3 non-negative (base 10) long integer numbers and a base B (B is in the range 2-9) and writes the number to the screen as a base B number. The program prompts the user for 3 numbers and bases, and then outputs them.
Use as input:
7210 Base 4
5310 Base 2
355310 Base 8

2. ## Big Java Chapter 8 Programming Exercise P8.4 BankAccount Solution

Regular Price: \$5.00

Special Price: \$4.00

Big Java Chapter 8 Programming Exercise P8.4 BankAccount

Enhance the BankAccount class by adding preconditions for the constructor and the deposit method that require the amount parameter to be at least zero, and a precondition for the withdraw method that requires amount to be a value between 0 and the current balance. Use assertions to test the preconditions.

3. ## Greatest Common Divisor GCD using euclidean algorithm Java Program

\$5.00

Greatest Common Divisor GCD using euclidean algorithm Java Program

This program will calculate the greatest common divisor of two positive integers using euclidean algorithm. in its simplest form, Euclid's algorithm starts with at pair of positive integers and forms a new pair that consists of the smaller number and the difference between the larger and smaller umbers. the process repeats until the numbers are equal. That number then is the greatest common divisor of the original pair. for example,to calculate the GCD of 49 and 35 the GCD of 49 and 35 is 7. Program input and output should use JOption. the validity of the inputs shall be checked and user error messages are displayed.

4. ## LastWord Java Program

\$5.00

LastWord Java Program

1 LastWord.java
You will write a Java program with the file name LastWord.java. The purpose of this program is to scan through a file and find in the file:
1. The word that is closest to the beginning of the dictionary
2. The word that is closest to the end of the dictionary
3. The longest word
For the purpose of this program, a word is defined as a string of characters delimited by whitespace that starts with a letter and ends with a letter. If a string of character delimited by whitespace that starts with one or more non-letters, they should be trimmed until the first character is a letter. Same should be done to the trailing non-letters. For example, the string of character “quote” should be trimmed to quote, --dash-- should be trimmed to dash. The non-letter enclosed by letters should be left alone. This definition of a word may make your English teachers cringe, but will be much easier to implement.
The lexicographical order of the words can be determined simply by using the compareToIgnoreCase() method of String class.
The input file name should be entered by a JOptionPane input dialog box.
2 Suggested Procedure
1. Start the program by popping up an input dialog box to ask user for a file name.
2. Instantiate a FileReader using the file name wrapped in a BufferedReader.
3. nstantiate a FileWriter wrapped in a BufferedWriter.  The output file name may be hardcoded.
4. Test the program by reading the input file and write the input to the output file. Compare the input file and output file.
5. Instantiate a Scanner that scans the BufferedReader. By default the Scanner delimits the tokens by whitespaces. Write the scanned tokens, one per line, to the output file. Exam the output file.
6. Write a new public class named WordSmith.  Create a static method trim() to remove the non-letters around the words. Test WordSmith.trim() until you are satisfied.
7. Back to LastWord, between Scanner output and write to output, insert a call to WordSmith.trim(). Create a test file with all the possible scenarios you can think of.  It will be more effective if you write out the word before and after trim() is called side-by-side on the same line.
8. Consider sharing your test file at DocSharing.
9. Add the code to LastWord to find the first word, last word, and the longest word.
10. Use JOptionPane.showMessageDialog() to display the results. Show the file name used in the title of the dialog box.

Deliverables
Source file(s): LastWord.java and WordSmith.java

5. ## Game of Guessing Numbers Java Program

\$5.00

Game of Guessing Numbers Java Program

In a game of guessing numbers, one person says "I am thinking of a number between 1 and 100". The second person guesses "50". The first person says "No it is less". The second person guesses "20". The first person says "No it is greater". This continues until the second person guesses the number. Write a program that plays this game. The computer knows the number (a random number between 1 and 100). The user (the second person) is the guesser. At the end of the program, the computer must displays the number of guesses it took the user to guess the number.
The program must include:
A main class
A loop (for, while or do-while)
An if or if – else statement
Must accept input from the keyboard
Must have a prompting statement
A separate class with a constructor
At least one method that performs an operation required by the main program

HERE IS AN ALGORITHM, PLEASE MAKE IT AS SIMPLE AS YOU CAN AND STILL INCLUDE THE NECESSARY RULES.
• Prompt
• Generate a random number (1-100)
Computer = gen random # (1-100)
Stop = false;
{
If (myNum = computeNum
Stop = true
{
(System.out.println(“You win!”);
}
Else
If (myNum>computeNum)
{
}
Else
If (myNum<computeNum)
{
}
}

6. ## Big Java Chapter 8 Programming Exercise P8.13 Numeric Solution

Regular Price: \$5.00

Special Price: \$4.00

Big Java Chapter 8 Programming Exercise P8.13 Numeric Solution

Consider the following algorithm for computing xn for an integer n. If  n < 0, xn is 1/x–n. If n is positive and even, then xn = (xn/2)2. If n  is positive and odd, then xn = xn–1 ⋅ x. Implement a static method double intPower(double x, int n) that uses this algorithm. Add it to a class called Numeric.

7. ## Stack to print the Prime Factors Java Program

\$5.00

Stack to print the Prime Factors Java Program

For a given integer n > 1, the smallest integer d > 1 that divides n is a prime factor. We can find the prime factorization of n if we find d and then replace n by the quotient of n divided by d, repeating this until n becomes 1.

Write a Java program that uses a stack (in Arrays) to print the prime factors of a positive integer in descending order.

For example, for n = 3960, the program should produce:
11*5*3*3*2*2*2

8. ## Big Java Chapter 8 Programming Exercise P8.3

Regular Price: \$5.00

Special Price: \$4.00

Big Java Chapter 8 Programming Exercise P8.3

Real cash registers can handle both bills and coins. Design a single class that expresses the commonality of these concepts. Redesign the CashRegister class and provide a method for entering payments that are described by your class. Your primary challenge is to come up with a good name for the class.

9. ## Remove hyphens from a word Java program

\$5.00

Remove hyphens from a word Java program

This program will remove the hyphens from a word. a string (delimited by whitespaces) with hyphens is divided into substrings delimited by hyphen.
Program outputs shall go to the console display.
input: WORD-word
expected output: WORD word

10. ## Product Entry Input and Output Stream Java Program

Regular Price: \$12.00

Special Price: \$8.00

Product Entry Input and Output Stream Java Program

Simple Application
Develop a simple application that contains the following:
It should product id, product name, and product price entered from the user, and write this information to a file.
The application should repeatedly prompt for this product information until terminated by the user.

Submit your zipped project with all files, including resulting output files, and screenshots demonstrating that your code runs and that you used the debugger to set breakpoints and watch variables.

Example product file:
1001 Rake 20.00
1002 Hose 15.00
1003 Lawn mower 200.00

Discussion
In 3–5 paragraphs, address the following:
Explain which input and output stream classes you used and your reasons for your choices.