Java exercises

Write a command line program that will print out the lyrics to 99 Bottles.
Begin Exercise
Write a program that creates a two-dimensional array initialized with test data. Use any primitive data type you wish.
Begin Exercise
Write an application that asks the user to enter a 10-character telephone number and translates alphabetic characters to numeric equivalent
Begin Exercise
Write a class that has three overloaded static methods for calculating the areas for circles, rectangles and cylinders with the provided formulas.
Begin Exercise
Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years.
Begin Exercise
Write a program that asks for the number of checks written for the month. The program should then calculate and display the bank's services fees for the month.
Begin Exercise
Write a program that asks the user to enter today’s sales for five stores.
Begin Exercise
Write a program that calculates and displays a person's BMI.
Begin Exercise
Write a program that asks the user to enter the number of books that he or she has purchased this month and displays the number of points awarded.
Begin Exercise
Write a program that asks the user to enter the amount that he or she has budgeted for a month. A loop should then prompt the user to enter each of his or her expenses for the month, and keep a running total.
Begin Exercise
For this exercise, you will design a set of classes that work together to simulate a car's fuel gauge and odometer. The classes you will design are a FuelGauge and Odometer.
Begin Exercise
The westfield carpet company has asked you to write an application that calculates the price of carpeting for rectangular rooms. To calculate the price, you multiply the area of the floor(width times length) by the price per square foot of carpet.
Begin Exercise
Write a program that displays temps up to 100 degrees fahrenheit.
Begin Exercise
Write a program that asks the user to enter a string and then asks the user to enter a character.
Begin Exercise
Write a program that demonstrates the Circle class by asking the user for the circle's radius, creating a Circle object, and then reporting the circle's area, diameter, and circumference.
Begin Exercise
Write a program that asks the user for the retail price of a circuit board calculates the amount of profit earned for that product, and displays...
Begin Exercise
Write a program that demonstrates the Coin class. The program should create an instance of the class and display the side that is initially facing up. Then, use a loop to toss the coin 20 times.
Begin Exercise
Write a program that generate all combinations of a set returning only that satisfy a size of n.
Begin Exercise
The numbers in the deposits.txt file are the amounts of deposits that were made to a savings account during the month, and the numbers
Begin Exercise
Write a program that plays a simple dice game between the computer and the user.
Begin Exercise
Write a program that asks the user to enter a distance in meters.
Begin Exercise
Write a program that test your esp (extrasensory perception). The program should randomly select the name of a color...
Begin Exercise
A soft drink company recently surveyed 12,467 of its customers and found that approximately 14 percent of those surveyed purchase one or more energy
Begin Exercise
Write a program with a method named isEven that accepts an int argument. The method should return true if the argument is even, or false if otherwise.
Begin Exercise
Write a program that asks the user to enter the number of calories and fat grams in a food item.
Begin Exercise
For this assignment, you will write a program that simulates a fishing game. In this game, a six-sided die is rolled to determine what the user has caught
Begin Exercise
Write a program that demonstrate the class. The program should ask the user to enter a temperature, and then display a list of the substance that will freeze at that temperature and those that will boil at that temperature.
Begin Exercise
For this assignment, you will write a program that lets the user play against the computer in a variation of the popular blackjack card game.
Begin Exercise
Design a Geometry class that calculates the area of a circle, triangle and a rectangle. Display an error message if user enters a number outside of range.
Begin Exercise
Write a program that allows a user to enter in test scores.
Begin Exercise
Write a program that generates a random number and asks the user to guess what the number is.
Begin Exercise
Write a method named isPrime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise.
Begin Exercise
Write a program that calculates the number of acres in a tract of land with 389,767 square feet.
Begin Exercise
Write a program that asks the user to enter a month (in numeric form), a day, and a two-digit year. The program should then determine whether the day times the month is equal to the year; if so, it should display a message indicating that the date is magic.
Begin Exercise
Write a program that asks the user to enter an object’s mass, and then calculate its weight. If the object weighs more than 1000 Newtons, display a message indicating that it is too heavy.
Begin Exercise
Write a program that asks the user to input the number of miles driven and gas used.
Begin Exercise
Write a program with a class that contains methods wordCount, mostFrequent, and replaceSubstring string operations
Begin Exercise
Write a program that asks the user to enter a string, and then converts that string to Morse code. Use hyphens for dashes and periods for dots.
Begin Exercise
Write a program that computes loan payments. The loan can be a car loan, a student loan, or a home mortgage loan.
Begin Exercise
Write a program that reads the contents of the two files into two separate arrays, or ArrayLists. The user should be able to enter a boy’s name, or a girl’s name, or both.
Begin Exercise
Write program that accepts users input and validates if the input is a palindrome.
Begin Exercise
For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. You should design ParkedCar, ParkingMeter, PoliceOfficer and ParkingTicket class.
Begin Exercise
Write a program to validate passwords based on length, if it contains an upper/lower case char and contains a digit
Begin Exercise
Write a program that calculates the amount a person would earn over a period of time if his or her salary is one penny the first day...
Begin Exercise
Write a class named PhoneBookEntry that has fields for a person’s name and phone number. The class should have a constructor and appropriate accessor and mutator methods.
Begin Exercise
Write a program that reads a sentence as input and converts each word to Pig latin.
Begin Exercise
Write a program that has a function named presentValue that performs this calculation.
Begin Exercise
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles.
Begin Exercise
Write a program that computes the tax and tip for a restaurant bill.
Begin Exercise
Write a program that lets the user play the game of Rock, Paper, Scissors against the computer.
Begin Exercise
Write a program that prompts the user to enter a number within the range of 1 through 10. The program should display the Roman numeral version of that number.
Begin Exercise
Write a program that asks for the names of runners and the time it took each of them to finish a race.
Begin Exercise
Write a program that opens a file and processes daily sales numbers. The program should provide weekly and overall summary statistics
Begin Exercise
Design a SavingsAccount class that stores a savings account’s annual interest rate and balance. The class constructorshould accept the amount of the savings account’s starting balance.
Begin Exercise
Write a program that simulates a slot machine.
Begin Exercise
Write a program that asks the user to enter three names, and then display the name sorted in ascending order.
Begin Exercise
Write a program that displays a menu allowing the user to select air, water, or steel.
Begin Exercise
Write a program that asks the user for a positive integer no greater than 15. The program should then draw a square on an output file using the character ‘X’.
Begin Exercise
Kathryn bought 600 shares of stock at a price of $21.77 per share. She must pay her stockbroker a 2 percent commission for the transaction.
Begin Exercise
Write a program that displays stock transactions.
Begin Exercise
Write a program that asks the user to enter the name of his or her favorite city. Use a String variable to store the input
Begin Exercise
Write a program that asks the user to enter a series of single digit numbers and calculate the sum of all the numbers
Begin Exercise
Write a program that asks the user to enter in test scores and then displays the average score.
Begin Exercise
Design a TestScores class that has fields to hold three test scores. The class should have a constructor, accessor and mutator methods for the test score fields, and a method that returns the average of the test scores.
Begin Exercise
For this assignment you will create a game program using the coin class from the coin toss simulator exercise. The program should have three three instances of the coin class: one representing a quarter, one representing a dime, and one representing a nickel
Begin Exercise
The program should create an array of 10 Question objects, one for each trivia question. Make up your own trivia questions on the subject or subject of your choice for the objects.
Begin Exercise
Write a program that asks the user for the names of two files. The first file should be opened for reading and the second file should be opened for writing.
Begin Exercise
Write a method that accepts String objects as an argument and returns the number of words.
Begin Exercise
Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase.
Begin Exercise
Write a program that lets the user enter the name of a team and then displays the number of times that team has won the world series in the time period from 1903 through 2009.
Begin Exercise
Write a program that solves the following equation using Cramer’s rule and displays the value for x and y
Begin Exercise
Write a program that displays the result of approximate pi values
Begin Exercise
Write a program that displays the area and perimeter of a circle.
Begin Exercise
Write a program that displays the area and perimeter of a rectangle.
Begin Exercise
Write a program that prompts the user to enter the side of a hexagon and displays its area.
Begin Exercise
Write a program that prompts the user to enter the length from the center of a pentagon to a vertex and computes the area of the pentagon.
Begin Exercise
Write a main method that prompts the user to enter the number of sides and the side of a regular polygon and displays its area.
Begin Exercise
Write a main method that prompts the user to enter the number of sides and the side of a regular polygon and displays its area
Begin Exercise
Write a program that reads student scores, gets the best score, and then assigns grades based
Begin Exercise
Write two overloaded methods that return the average of an array.
Begin Exercise
Write a program that displays the average speed in kilometers per hour.
Begin Exercise
Write a program that displays the average speed in miles per hour
Begin Exercise
Write a sort method that uses the bubble sort algorithm. The bubble sort algorithm makes several passes through the array
Begin Exercise
Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value.
Begin Exercise
Write a program that reads the balance and the annual percentage interest rate and displays the interest for the next month.
Begin Exercise
Write the following method that returns true if the list is already sorted.
Begin Exercise
Write a program that lets the user enter the loan amount and loan period in number of years.
Begin Exercise
Write a program that prompts the user to enter a monthly saving amount and displays the account value after the sixth month.
Begin Exercise
Write a program that prompts that calculates compound value
Begin Exercise
Write a program that prompts the user to enter an amount and calculates a CD value
Begin Exercise
Computes the standard deviation of numbers by creating two methods deviation and mean.
Begin Exercise
Write a program that displays the result of two random expressions
Begin Exercise
Write a program that computes the tuition in ten years and the total cost of four years’ worth of tuition starting ten years from now.
Begin Exercise
Find the greatest common divisor of two integers n1 and n2.
Begin Exercise
Write a program that reads three edges for a triangle and computes the perimeter if the input is valid.
Begin Exercise
Write a program that reads in the radius and length of a cylinder and computes the area and volume
Begin Exercise
Write a program that displays conversion from kilograms to pounds in a table.
Begin Exercise
Write a program that displays conversion from miles to kilometers in a table.
Begin Exercise
Write a program that reads a Celsius degree in a double value from the console, then converts it to Fahrenheit and displays the result.
Begin Exercise
Write a program that reads a number in feet, converts it to meters, and displays the result.
Begin Exercise
Write a program that prompts the user to enter a letter grade A, B, C, D, or F and displays its corresponding numeric value 4, 3, 2, 1, or 0.
Begin Exercise
Write a program that converts pounds into kilograms.
Begin Exercise
Write a program that reads the integers between 1 and 100 and counts the occurrences of each. Assume the input ends with 0.
Begin Exercise
Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros).
Begin Exercise
Write a program that generates 100 random integers between 0 and 9 and displays the count for each number.
Begin Exercise
Write a program that prompts the user to enter a string and displays the number of the uppercase letters in the string.
Begin Exercise
Write a program that prompts the user to enter a string and displays the number of vowels and consonants in the string.
Begin Exercise
Write a program to simulate the number of picks needed to get four cards from each suit and display the four cards picked.
Begin Exercise
Write a program that displays the current time in GMT
Begin Exercise
Write a program that prompts the user to enter a decimal integer and displays its corresponding binary value.
Begin Exercise
Write a program that prompts the user to enter an integer between 0 and 15 and displays its corresponding hex number.
Begin Exercise
Write a program that prompts the user to enter a decimal integer and displays its corresponding octal value.
Begin Exercise
Write a program that displays a pattern
Begin Exercise
Write a program that prompts the user to enter an integer from 1 to 15 and displays a pyramid
Begin Exercise
Write a method with the following header to display an integer in reverse order
Begin Exercise
Write a program that prompts the user to enter the year and first day of the year and displays the calendar table for the year on the console.
Begin Exercise
Write a program to display the current date and time.
Begin Exercise
Write a program that displays Welcome to Java five times.
Begin Exercise
Use nested for loops that displays a pattern.
Begin Exercise
Write a program that displays all the leap years, ten per line, in the twenty-first century
Begin Exercise
Write a test program that prompts the user to enter n and displays an n-by-n matrix
Begin Exercise
Write a nested for loop that prints numbers in a pyramid pattern.
Begin Exercise
Display all the prime numbers between 2 and 1,000, inclusive
Begin Exercise
Write a program that randomly generates an integer between 1 and 12 and displays the English month
Begin Exercise
Write a program that prints characters in a range.
Begin Exercise
Write a program that prints the characters in the ASCII character table from ! to ~.
Begin Exercise
Write a program that prompts the user to enter the year and first day of the year, and displays the first day of each month in the year on the console.
Begin Exercise
Write a program that displays to the console that contains three strings.
Begin Exercise
Write a test program that reads in ten integers, invokes the method that will eliminate duplicate values, and displays the result.
Begin Exercise
Write a program that randomly generates an array of 100,000 integers and a key to search and sort
Begin Exercise
Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total.
Begin Exercise
Write a program prompt the user to enter the weight and price of the each package and displays the one with the better price
Begin Exercise
Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to Chinese RMB.
Begin Exercise
Write a program that prompts the user to enter an integer for today’s day of the week and a future day of the week.
Begin Exercise
Write a program that displays all the numbers from 100 to 1,000, ten per line, that are divisible by 5 and 6.
Begin Exercise
Write a program that receives an ASCII code (an integer between 0 and 127) and displays its character.
Begin Exercise
Write a program that reads an integer and displays all its smallest factors in increasing order.
Begin Exercise
Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the name of the student with the highest score.
Begin Exercise
Write a method that returns the index of the smallest element in an array of integers.
Begin Exercise
Write a program that prompts the user to enter the month and year and displays the number of days in the month.
Begin Exercise
Write a program that prompts the user to enter the minutes and displays the number of years and days for the minutes.
Begin Exercise
Write a program that finds out the minimum number of sales you have to generate in order to make $30,000.
Begin Exercise
Write a method that finds the smallest element in an array of double values
Begin Exercise
Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the highest score and the student with the second-highest score.
Begin Exercise
Write a test program that prompts the user to enter a number and its width and displays a string returned by invoking format
Begin Exercise
Write a program to generate three single-digit integers and prompt the user to enter the sum of these three integers.
Begin Exercise
Write a program to play a variation of the game of the popular craps dice game!
Begin Exercise
Generate a lottery of a three digit numbers. The program prompts the user to enter a three-digit number and determines whether the user wins.
Begin Exercise
Write a program to print 100 uppercase letters and then 100 single digits, printing ten per line.
Begin Exercise
Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a program to generate a plate number.
Begin Exercise
Write a program that prompts the user to enter four points and displays the intersecting point.
Begin Exercise
Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the rectangle.
Begin Exercise
Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the circle
Begin Exercise
Write a program that prompts the user to enter the three points for p0, p1, and p2 and displays whether p2 is on the left of the line from p0 to p1, to the right, or on the same line.
Begin Exercise
Write a program that prompts the user to enter a point with x and y-coordinates and determines whether the point is inside the triangle.
Begin Exercise
Write a program that prompts the user to enter the center coordinates and radii of two circles and determines whether the second circle is inside the first or overlaps with the first.
Begin Exercise
Write a program that prompts the user to enter the center x-, y-coordinates, width, and height of two rectangles and determines whether the second rectangle is inside the first or overlaps with the first.
Begin Exercise
Write a program that lets the user guess whether the flip of a coin results in heads or tails.
Begin Exercise
The monthly payment for a given loan pays the principal and the interest.
Begin Exercise
Write a program to display all open locker numbers separated by exactly one space
Begin Exercise
Write a program that displays all possible combinations for picking two numbers from integers 1 to 7. Also display the total number of all combinations.
Begin Exercise
Write a program that prompts the user to enter 10 integers and displays all combinations of picking two numbers from 10.
Begin Exercise
Write a method that returns the number of days in a year.
Begin Exercise
Write a program that reads integers, finds the largest of them, and counts its occurrences.
Begin Exercise
Write a method that finds the number of occurrences of a specified character in a string
Begin Exercise
Write a program that prompts the user to enter three cities and displays them in ascending order
Begin Exercise
Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.
Begin Exercise
Write a method that returns a pentagonal numbers
Begin Exercise
Write a program that will display four perfect numbers less than 10,000.
Begin Exercise
Write a program that prompts the user to enter the starting velocity v0 in meters/second, the ending velocity v1 in meters/second, and the time span t in seconds, and displays the average acceleration.
Begin Exercise
Write a program that prompts the user to enter v in meters/second (m/s) and the acceleration a in meters/second squared (m/s2), and displays the minimum runway length.
Begin Exercise
Write a program that simulates picking a card from a deck of 52 cards.
Begin Exercise
Write a program that picks four cards from a deck of 52 cards and computes their sum.
Begin Exercise
Write a program that prompts the user to enter the three points for p0, p1, and p2 and displays whether p2 is on the line segment from p0 to p1.
Begin Exercise
Write a program to display the population for each of the next five years.
Begin Exercise
Write a program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly one space.
Begin Exercise
Write a program that displays in a table format a number, square and the power of 3.
Begin Exercise
Write a program that displays a random uppercase letter using the Math.random() method.
Begin Exercise
Write a method that returns a random number between 1 and 54, excluding the numbers passed in the argument.
Begin Exercise
Write a program that prompts the user to enter a string and displays the string in reverse order
Begin Exercise
Write a test program that prompts the user to enter ten numbers, invokes the method to reverse the numbers, and displays the numbers.
Begin Exercise
Write a program that reads ten integers and displays them in the reverse of the order in which they were read.
Begin Exercise
Write a program that calculates the energy needed to heat water from an initial temperature to a final temperature.
Begin Exercise
Write a program that prompts the user to enter a year, month, and day of the month, and displays the name of the day of the week.
Begin Exercise
Write a test program that reads in ten double numbers, invokes the method, and displays the sorted numbers
Begin Exercise
Write a program that prompts the user to enter values for a, b, and c and displays the result based on the discriminant.
Begin Exercise
Write a method that returns a sorted string.
Begin Exercise
Write a program that prompts the user to enter the number of students, the students’ names, and their scores, and prints student names in decreasing order of their scores.
Begin Exercise
Write a program that sorts three integers.
Begin Exercise
Write a test program that prompts the user to enter two lists of integers and displays whether the two are strictly identical.
Begin Exercise
Write a program to sum a series of numbers
Begin Exercise
Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer.
Begin Exercise
Write a program that sums the numbers one through nine.
Begin Exercise
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN.
Begin Exercise
Write a program that prompts the user to enter a social Security number in the format DDD-DD-DDDD, where D is a digit.
Begin Exercise
Write a program that prompts the user to enter a letter and check whether the letter is a vowel or consonant.
Begin Exercise
Write a program that prompts the user to enter a temperature between -58􏰀F and 41􏰀F and a wind speed greater than or equal to 2 and displays the wind-chill temperature.
Begin Exercise