2.99 See Answer

Question: Dice are used in many games. One


Dice are used in many games. One die can be thrown to randomly show a value from 1 through 6.
Design a Die class that can hold an integer data field for a value (from 1 to 6). Include a constructor that randomly assigns a value to a die object. For example, the following statement generates a random number between LOWEST_DIE_VALUE (which should contain the value 1) and HIGHEST_DIE_VALUE (which should contain the value 6) and assigns it to a variable.
randomValue = ((int)(Math.random() * 100) %
HIGHEST_DIE_VALUE + LOWEST_DIE_VALUE);
Also include a method in the class to return a Die’s value. Save the class as Die.java. Write an application that randomly “throws” two dice and displays their values. Save the application as TwoDice.java. Using the Die class, write an application that randomly “throws” five dice for the computer and five dice for the player. Display the values and then, by observing the results, decide who wins based on the following hierarchy of Die values. (The computer will not decide the winner; the player will determine the winner based on observation. Later, you will learn to program the determination of the winner.) Any higher combination beats a lower one; for example, five of a kind beats four of a kind.
❯❯ Five of a kind
❯❯ Four of a kind
❯❯ Three of a kind
❯❯ A pair
After you learn about decision making, you will be able to make the program determine whether you or the computer had the better roll. For now, just observe how the values change as you execute the program multiple times. Save the application as FiveDice.java.


> You have been assigned to develop a model that can be used to schedule employees at a local fast food restaurant. Assume that computer technology has advanced to the point where very large problems can be solved on a PC at the restaurant. a. What data wo

> Three bonds, as listed in the file, are currently for sale. Each bond has a face value of $100. Every six months, starting six months from the current date and ending at the expiration date, each bond pays 0.5*(coupon rate)*(Face value). At the expiratio

> Based on Glassey and Gupta (1978). A paper recycling plant processes box board, tissue paper, newsprint, and book paper into pulp that can be used to produce three grades of recycled paper. The prices per ton and the pulp contents of the four inputs are

> During each six-hour period of the day, the Bloomington Police Department needs at least the number of police officers shown in the file P04_125.xlsx. Police officers can be hired to work either 12 consecutive hours or 18 consecutive hours. Police office

> Based on Robichek et al. (1965). At the beginning of month 1, Finco has $35,000 in cash. At the beginning of months 1, 2, 3, and 4, Finco receives certain revenues, after which it pays bills. (See the file P04_124.xlsx.) Any money left over can be invest

> Based on Dobson and Kalish (1988). Chandler Enterprises produces two competing products, A and B. The company wants to sell these products to two groups of customers. The values each customer places on a unit of A and B are shown in the file. Each custom

> Based on Carino and Lenoir (1988). Brady Corporation produces cabinets. Each week, Brady requires 90,000 cubic feet of processed lumber. The company can obtain lumber in two ways. First, it can purchase lumber from an outside supplier and then dry it at

> Based on Franklin and Koenigsberg (1973). The city of Busville contains three school districts. The numbers of minority and nonminority students in each district are given in the file P04_121.xlsx. The local court has decided that each of the town’s two

> Bexter Labs produces three products: A, B, and C. Bexter can sell up to 2000 units of product A, up to 2500 units of product B, and up to 800 units of product C. Each unit of product C uses two units of A and three units of B and incurs $5 in processing

> Consider the exponential curve y = 1000e-0.014x. Calculate y when x = 5; when x = 10; and when x = 20. For each of these values of x, find the percentage change in y when x increases by one unit. That is, find the percentage change in y when x increases

> Each week, Chemco can purchase unlimited quantities of raw material at $6 per pound. Each pound of purchased raw material can be used to produce either input 1 or input 2. Each pound of raw material can yield 2 ounces of input 1, requiring 2 hours of pro

> Flexco produces six products in the following manner. Each unit of raw material purchased yields 4 units of product 1, 2 units of product 2, and 1 unit of product 3. Up to 1200 units of product 1 can be sold, and up to 300 units of product 2 can be sold.

> Sunco Oil has three different processes that can be used to manufacture various types of gasoline. Each process involves blending oils in the company’s catalytic cracker. Running process 1 for an hour costs $20 and requires two barrels of crude oil 1 and

> Rylon Corporation manufactures Brute cologne and Chanelle perfume. The raw material needed to manufacture each type of fragrance can be purchased for $60 per pound. Processing 1 pound of raw material requires 1 hour of laboratory time. Each pound of proc

> Owens-Wheat uses two production lines to produce three types of fiberglass mat. The demand requirements (in tons) for each of the next four months are shown in the file P04_115.xlsx. If it were dedicated entirely to the production of one product, a line

> Each hour from 10 a.m. to 7 p.m., Bank One receives checks and must process them. Its goal is to process all checks the same day they are received. The bank has 5 check processing machines, each of which can process up to 1200 checks per hour. It takes o

> Mackk Engine produces diesel trucks. New government emission standards have dictated that the average pollution emissions of all trucks produced in the next three years cannot exceed 12 grams per truck. Mackk produces two types of trucks. Each type 1 tru

> Based on Robichek et al. (1965). The Korvair Department Store has $100,000 in available cash. At the beginning of each of the next six months, Korvair will receive revenues and pay bills as listed in the file P04_112.xlsx. It is clear that Korvair will h

> Based on Lanzenauer et al. (1987). To process income tax forms, the IRS first sends each form through the data preparation (DP) department, where information is coded for computer entry. Then the form is sent to data entry (DE), where it is entered into

> The production line employees at Grummins Engine work four days per week, 10 hours per day. Each day of the week, the following minimum numbers of line employees are needed: Monday through Friday, 70 employees; Saturday and Sunday, 40 employees. Grummins

> Consider the power curve y = 10000x-2.35. Calculate y when x = 5; when x = 10; and when x = 20. For each of these values of x, find the percentage change in y when x increases by 1%. That is, find the percentage change in y when x increases from 5 to 5.0

> The Fresh Turkey Company produces two types of turkey cutlets for sale to fast-food restaurants. Each type of cutlet consists of white meat and dark meat. Cutlet 1 sells for $2.97 per pound and must consist of at least 65% white meat. Cutlet 2 sells for

> Based on Smith (1965). Silicon Valley Corporation (Silvco) manufactures transistors. An important aspect of the manufacture of transistors is the melting of the element germanium (a major component of a transistor) in a furnace. Unfortunately, the meltin

> City 1 produces 500 tons of waste per day, and city 2 produces 400 tons of waste per day. Waste must be incinerated at incinerator 1 or 2, and each incinerator can process up to 500 tons of waste per day. The cost to incinerate waste is $40 per ton at in

> Based on Charnes and Cooper (1955). Alex Cornby makes his living buying and selling corn. On January 1, he has 6000 bushels of corn and $16,000 in cash. On the first day of each month, Alex can buy corn at the forecasted prices per bushel listed in the f

> Based on Rothstein (1973). The Springfield City Police Department employs 30 police officers. Each officer works five days per week. The crime rate fluctuates with the day of the week, so the number of police officers required each day depends on the day

> Gotham City National Bank is open Monday through Friday from 9 a.m. to 5 p.m. From past experience, the bank knows that it needs the numbers of tellers listed in the file P04_104.xlsx. Gotham City Bank hires two types of tellers. Full-time tellers work 9

> During the next three months, a heating and cooling company must meet (on time) the following demands for air conditioners: month 1, 600; month 2, 400; and month 3, 300. Air conditioners can be produced in either New York or Los Angeles. It takes 1.5 hou

> Each day, Eastinghouse produces capacitors during three shifts: 8 a.m. to 4 p.m., 4 p.m. to 12 a.m., and 12 a.m. to 8 a.m. The hourly salary paid to the employees on each shift, the price charged for each capacitor made during each shift, and the number

> Aluminaca produces 100-foot-long, 200-foot-long, and 300-foot-long ingots for customers. This week’s demand for ingots is listed in the file. Aluminaca has four furnaces in which ingots can be produced. During one week, each furnace can be operated for 5

> You are a CFA (chartered financial analyst). An overextended client has come to you because she needs help paying off her credit card bills. She owes the amounts on her credit cards listed in the file. The client is willing to allocate up to $6000 per mo

> Suppose you have an extra six months of data on demands and prices, in addition to the data in the example. These extra data points are (350,84), (385,72), (410,67), (400,62), (330,92), and (480,53). (The price is shown first and then the demand at that

> The sensitivity analysis in the Quality Sweaters example was on the response rate. Suppose now that the response rate is known to be 8%, and the company wants to perform a sensitivity analysis on the number mailed. After all, this is a variable under di

> Write, compile, and test a class that displays the pattern shown in Figure 1-27. Save the class as Triangle.java.

> Write, compile, and test a class that displays the pattern shown in Figure 1-26. Save the class as TableAndChairs.java.

> Write, compile, and test a class that uses four println() statements to display, in order, your favorite movie quote, the movie it comes from, the character who said it, and the year of the movie. Save the class as MovieQuoteInfo.java.

> Sunshine Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Write a program that prompts the user for the number of minutes the user rented a piece of sports equipment. Compute the rental cost as $40

> Yummy Catering provides meals for parties and special events. Write a program that prompts the user for the number of guests attending an event and then computes the total price, which is $35 per person. Display the company motto with the border that you

> a. Sunshine Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Write a program that displays Sunshine’s motto, which is Sunshine Seashore makes it fun in the sun. Save the file as SunshineMotto.java.

> a. Yummy Catering provides meals for parties and special events. Write a program that displays Yummy Catering’s motto, which is Yummy makes the food that makes it a party. Save the file as YummyMotto.java. b. Create a second program that displays the mo

> Write, compile, and test a class that uses four println() statements to display four lines of the lyrics of your favorite song. Save the class as SongLyrics.java.

> a. Sunshine Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Create a Rental class for the company. The Rental class contains the following: ❯❯ Two public final static fields that hold the number of

> a. Create a class to hold Event data for Yummy Catering. The class contains the following: ❯❯ Two public final static fields that hold the price per guest ($35) and the cutoff value for a large event (50 guests). ❯❯ Three private fields that hold an eve

> Sunshine Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. In Chapter 2, you wrote an application that prompts the user for the number of minutes a piece of sports equipment was rented, displays the

> Yummy Catering provides meals for parties and special events. In Chapter 2, you wrote an application that prompts the user for the number of guests attending an event, displays the company motto with a border, and then displays the price of the event and

> Mad Libs is a children’s game in which the players provide a few words that are then incorporated into a silly story. For example, you might ask a child for the name of an animal, a number, and a direction. The child might reply with such answers as dog,

> Mad Libs is a children’s game in which they provide a few words that are then incorporated into a silly story. The game helps children understand different parts of speech because they are asked to provide specific types of words. For example, you might

> Recall how to obtain a random number. For example, the following statement generates a random number between the constants MIN and MAX inclusive and assigns it to a variable named random: random = MIN + (int)(Math.random() * MAX); Write a program that se

> Computer games have been around for a long time: •In 1947, Thomas T. Goldsmith Jr. and Estle Ray Mann filed the first patent for a computer game. •In 1952, A. S. Douglas wrote his University of Cambridge Ph.D. dissertation on human–computer interaction

> Computer games often contain different characters or creatures. For example, you might design a game in which alien beings possess specific characteristics such as color, number of eyes, or number of lives. Design a character for a game, creating a class

> Name at least three classes to which each of these objects might belong: a. myRedBicycle b. friedEgg c. cellPhone

> Playing cards are used in many computer games, including versions of such classics as solitaire, hearts, and poker. Design a Card class that contains a character data field to hold a suit (s for spades, h for hearts, d for diamonds, or c for clubs) and a

> Recall how to obtain a random number. For example, the following statement generates a random number between the constants MIN and MAX inclusive and assigns it to a variable named random: random = MIN + (int)(Math.random() * MAX); Write a program that de

> Each of the following files saved in the Chapter03 folder in your downloadable student files has syntax and/or logic errors. In each case, determine and fix the problem. After you correct the errors, save each file using the same filename preceded with F

> Each of the following files in the Chapter02 folder of your downloadable student files has syntax and/or logic errors. In each case, determine the problem and fix the application. After you correct the errors, save each file using the same filename prece

> Each of the following files in the Chapter01 folder in your downloadable student files has syntax and/or logic errors. In each case, determine the problem and fix the errors. After you correct the errors, save each file using the same filename preceded w

> Each of the following files in the Chapter04 folder of your downloadable student files has syntax and/or logic errors. In each case, determine the problem and fix the program. After you correct the errors, save each file using the same filename preceded

> The LocalDate class includes an instance method named lengthOfMonth() that returns the number of days in the month. Write an application that allows the user to enter a month, day, and year and uses methods in the LocalDate class to calculate how many da

> Write an application that prompts a user for the user’s month, day, and year of birth and uses the LocalDate class to compute the day on which the user will become (or became) 10,000 days old. Save the application as TenThousandDaysOld.java.

> Write a program that declares two LocalDate objects and prompts the user for values. Display output that demonstrates the dates displayed when one, two, and three months are added to each of the objects. (When you test the program, be sure to try some da

> Write a Java application that prompts the user for an int and a double and then uses Math class methods to display each of the following: a. The square root of the int b. A random number between 0 and the int (Hint: The Math.random() method returns a val

> Name at least three real-life objects that are instances of each of the following classes: a. Song b. CollegeCourse c. Musician

> a. Create a class to hold data about a high school sports team. The Team class holds data fields for high school name (such as Roosevelt High), sport (such as Basketball), and team name (such as Dolphins). Include a constructor that takes parameters for

> Create a class named BloodData that includes String fields that hold a blood type (the four blood types are O, A, B, and AB) and an Rh factor (the factors are + and –). Create a default constructor that sets the fields to O and + and an overloaded const

> Create a FitnessTracker class that includes three data fields for a fitness activity: a String for the name of the activity, an int for the number of minutes spent participating, and a LocalDate for the date. The class includes methods to get each field.

> Create a class named Lease with fields that hold an apartment tenant’s name, apartment number, monthly rent amount, and term of the lease in months. Include a default constructor that initializes the name to XXX, the apartment number to 0, the rent to 10

> Create a class named Person that holds two String objects for the person’s first and last name. Include a constructor that requires an argument for each field. Include get methods for each field. Save the file as Person.java. b. Create a class named Cou

> Create a class named Sandwich. Data fields include a String for the main ingredient (such as tuna), a String for bread type (such as wheat), and a double for price (such as 4.99). Include methods to get and set values for each of these fields. Save the c

> The Renew Your Home Company estimates each job cost as the cost of materials plus $35 per hour while on the job, plus $12 per hour for travel time to the job site. Create a class that contains a main() method that prompts the user for the name of a job (

> The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current calendar year. The premium is computed by taking the decade of the customer’s age, adding 15 to it, and multiplying by 20. For ex

> Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompts the user for the length, width, and height of a rectangular room. Pass these three values to a method that does the followin

> There are 12 inches in a foot and 3 feet in a yard. Create a class named InchConversion. Its main() method accepts a value in inches from a user at the keyboard and then passes the entered value to two methods. One converts the value from inches to feet,

> Name at least three attributes that might be appropriate for each of the following classes: a. RealEstateListing b. Vacation c. CreditCardBill

> To encourage good grades, Hermosa High School has decided to award each student a bookstore credit that is 10 times the student’s grade point average. In other words, a student with a 3.2 grade point average receives a $32 credit. Create a class that pro

> Create an application named Percentages whose main() method holds two double variables, and prompt the user for values. Pass both variables to a method named computePercent() that displays the two values and the value of the first number as a percentage

> Create an application named NumbersDemo whose main() method holds two integer variables. Prompt the user for values for the variables. In turn, pass each value to methods named displayTwiceTheNumber(), displayNumberPlusFive(), and displayNumberSquared().

> Suppose that you have created a program with only the following variables: int age = 34; int weight = 180; double height = 5.9; Suppose that you also have a method with the following header: public static void calculate(int age, double size) Which of the

> Create a class named BookBilling that includes three overloaded computeBill() methods for the Happy Memories Company, which sells photo books. ❯ When computeBill() receives no parameters, the method computes the price of one photo book at $14.99, adds 8

> Create a class named Form Letter Writer that includes two overloaded methods named Display Salutation(). The first method takes one String parameter that represents a customer’s first name, and it displays the salutation Dear followed by the first name.

> Suppose that you have created a program with only the following variables: int x = 2; int y = 3; Suppose that you also have a method with the following header: public static void mathMethod(int x) Which of the following method calls are legal? a. mathMet

> Write a program that allows the user to enter an integer number of dollars and calculates and displays the conversion into currency denominations—20s, 10s, 5s, and 1s. Save the program as Dollars.java.

> a. The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult’s meal and $4 for a child’s meal. Write a program that accepts the number of each type of meal ordered, and display the total mo

> Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs or 45 cents for individual eggs that are not part of a dozen. Write a program that prompts a user for the number of eggs in the order and then display th

> Is each of the following method identifiers (a) legal and conventional, (b) legal but unconventional, or (c) illegal? a. associationRules() b. void() c. Golden Retriever() d. invoice#() e. 36542ZipCode() f. PayrollApp() g. getReady() h. 911() i.

> Write a program that declares a variable named inches, which holds a length in inches, and assign a value. Display the value in feet and inches; for example, 86 inches becomes 7 feet and 2 inches. Be sure to use a named constant where appropriate. Save t

> Write a program that declares named constants to represent the number of inches, feet, and yards in a mile. Also declare a variable named miles to represent a number of miles and assign a value to it. Compute and display, with explanatory text, the value

> Write a program that declares a named constant to hold the number of quarts in a gallon (4). Also declare a variable to represent the number of quarts needed for a painting job. Name the variable quartsNeeded, and assign 18 to it. Compute and display the

> Choose the best data type for each of the following so that any reasonable value is accommodated but no memory storage is wasted. Give an example of a typical value that would be held by the variable, and explain why you chose the type you did. a. the nu

> What is the value of each of the following Boolean expressions? a. 15 , 13 b. 8 ,5 (2 1 6) c. 15 55 15 d. 3 .5 3 e. 4 * 2 55 2 * 4 f. 5 , 8 2 3 g. 7 !5 7 h. 8 !5 (2 1 5) i. 10 2 20 55 210 j. 3 1 2 * 6 55 30

> Write a program that accepts as user input the names of three political parties and the number of votes each received in the last mayoral election. Display the percentage of the vote each party received. Save the program as ElectionStatistics.java.

> Write a program that accepts an integer number of minutes from a user and converts it both to hours and days. For example, 6,000 minutes equals 100 hours and equals 4.167 days. Save the program as MinutesConversion.java.

> What is the numeric value of each of the following expressions, as evaluated by Java? a. 4 1 6 * 2 b. 10 / 5 1 8 c. 12 / 4 1 16 / 2 d. 17 / 2 e. 22 / 5 f. 39 / 10 g. 19 % (2 1 3) h. 3 1 4 * 20 / 3 i. 36 % (6 1 2) j. 8 % 2 * 0

> From 1925 through 1963, Burma Shave advertising signs appeared next to highways across the United States. There were always four or five signs in a row containing pieces of a rhyme, followed by a final sign that read Burma Shave. For example, one set of

> Write, compile, and test a class that displays the following statement about comments on two lines: Program comments are nonexecuting statements you add to a file for documentation. Also include the same statement in three different comments in the class

> Is each of the following class identifiers (a) legal and conventional, (b) legal but unconventional, or (c) illegal? a. myClass b. void c. Golden Retriever d. invoice# e. 36542ZipCode f. Apartment g. Fruit h. 8888 i. display Total () j. Accounts_Receivab

> Jerford Company is a well-known manufacturing company with several wholly owned subsidiaries. The company’s stock is traded on the New York Stock Exchange, and the company files all appropriate reports with the SEC. Jerford’s financial statements are aud

> Title III of SOX specifies requirements for the membership of the audit committee and its authority. All publicly traded firms must follow SOX. Required a. Explain the role of the audit committee as SOX specifies, with regard to the annual audit conducte

> The purpose of the Securities Act of 1933 is to regulate the initial offering of a firm’s securities by ensuring that investors are given full and fair disclosure of all pertinent information about the firm. The Securities Exchange Act of 1934 was passed

> On July 1, 20X3, Barker Company purchased 20 percent of Acme Company’s outstanding common stock for $400,000 when the fair value of Acme’s net assets was $2,000,000. Barker does not have the ability to exercise signifi

> A variety of organizational structures are used by major companies, and different approaches to consolidation are sometimes found. Two large and familiar U.S. corporations are Union Pacific and ExxonMobil. Required a. Many large companies have tens or ev

2.99

See Answer