A painting company has determined that for every 115 sq.ft of wall space, one gallon of paint and 8 hours of labor is required. Company charges $18.00/hour for labor.
Write a program that allows user to enter the number of rooms to be painted and price of pain/gallon. It also should ask for sqft of wall space in each room.
It should have the methods that return the following data:

• Number of gallons of paint required
• Hours of labor required
• Cost of paint
• Labor charges
• Total cost of paint job

All of these data should be displayed on the screen also.

The winning numbers for a lottery are stored in an array and info of 5 people’s lottery choices are each stored in an array.

Your method should compare incoming array’s elements against the winning combo order of numbers and return how many numbers match between the two.

int[] winCombo = {74,89,13, 25, 46} //only this array is known to the method.
Main method should call the above method with each array and print the results. // Assume these values are available to you – you need not get user input.
//the following 5 arrays are known to main method only.

int[] Person1 = {11,25,35,25, 46}
int[] Person2 = {89,25,13,25,46} int[] Person3 = {74,89,13,25,46}
int[] Person4 = {89,74,25,46,13} int[] Person5 = {11,22,33,44,55}

For above sample input, expected output would be :
winning combo : 74,89,13,25,46
Person1’s choice : 11,25,35,25,46 - your match is 2
Person2’s choice : 89,25,13,25,46 - your match is 3
Person3’s choice : 74,89,13,25,46 - your match is 5 - hooray ! you win Person4’s choice : 89,74,25,46,13 - your match is 0
Person5’s choice : 11,22,33,44,55 - your match is 0

Write a method to find if 2 given Strings are anagrams. Write a main method that calls this method with 2 Strings and prints the result. 2 words are anagrams if they are of equal length and made of same characters but the order of occurrence might be different. (Remember Java is case sensitive - so make sure to use the built-in methods given by String class to stick with either uppercase or lowercase)

Sample Input :
Enter word #1 : listen
Enter word #2 : silent
Expected output : listen and silent are anagrams Sample Input :
Enter word #1 : hello
Enter word #2 : he
Expected output : hello and he are not anagrams

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Arrays;

public class LotteryChecker {
    // winning combo
    static int[] winCombo = {74, 89, 13, 25, 46};
    // this method returns how many numbers match (in order) between the winCombo and given numbers array
    public static int countMatchingNumbers(int[] lotteryChoice) {
       int matchesCount = 0;
       for(int i = 0; i < winCombo.length; i++) {
            if(lotteryChoice[i] == winCombo[i]) {
       return matchesCount;
    // this method is used to convert a given integer array to a properly formatted string
    public static String convertIntArrayToString(int[] intArray) {
       return Arrays.toString(intArray).replace("[", "").replace("]", "");

    public static void main(String[] args) {
       int[] Person1 = {11,25,35,25, 46};
       int[] Person2 = {89,25,13,25,46};
       int[] Person3 = {74,89,13,25,46};
       int[] Person4 = {89,74,25,46,13};
       int[] Person5 = {11,22,33,44,55};
       // print the winning combo
       System.out.println("Winning combo : " + convertIntArrayToString(winCombo));
       // find the number of matching numbers for all 5 persons and print the results
       int matches;
       matches = countMatchingNumbers(Person1);
       System.out.print("Person1's choice : " + convertIntArrayToString(Person1) + " - your match is " + matches);
       if (matches == winCombo.length) {
            System.out.println(" - hooray ! you win");
       } else {

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats