Create an Exception class named GradeException that contains a static public array of valid grade letters (A, B, C, D, F, and I) that you can use to determine whether a grade is valid. Save the file as GradeException.java. b. Write an application that displays a series of at least eight student ID numbers that you have stored in an array and asks the user to enter a letter grade for the student. Throw a GradeException if the user does not enter a valid letter grade as defined in the GradeException class. Catch the GradeException, and then display an appropriate message. In addition, store an I (for Incomplete) for any student for whom an Exception is caught. At the end of the application, display all the student IDs and grades. Save the file as TestGrade.java.
> The random-number generator on calculators randomly generates a number between 0 and 1. The random variable X, the number generated, follows a uniform probability distribution. (a)Draw the graph of the uniform density function. (b) What is the probabilit
> When conducting a cluster sample, it is better to have fewer clusters with more individuals when the clusters are heterogeneous.
> Find the probability that your friend is no more than 5 minutes late.
> Find the probability that your friend is at least 20 minutes late.
> (a) Find the probability that your friend is between 15 and 25 minutes late. (b) It is 10 A.M. There is a 90% probability your friend will arrive within the next ___ minutes.
> (a) Find the probability that your friend is between 5 and 10 minutes late. (b) It is 10 A.M. There is a 40% probability your friend will arrive within the next ___ minutes.
>
>
>
>
>
>
> A simple random sample is always preferred because it obtains the same information as other sampling plans but requires a smaller sample size.
> (a) A binomial experiment is performed a fixed number of times. Each repetition of the experiment is called a_____ . (b) For each repetition of a binomial experiment, there are two mutually exclusive outcomes:____ or_____ .
> State the criteria for a binomial probability experiment.
> When can the Empirical Rule be used to identify unusual results in a binomial experiment? Why can the Empirical Rule be used to identify results in a binomial experiment?
> Explain how the value of p, the probability of success, affects the shape of the distribution of a binomial random variable.
> Explain how the value of n, the number of trials in a binomial experiment, affects the shape of the distribution of a binomial random variable.
> Explain what “success” means in a binomial probability experiment.
> One measure of successful investing is being able to “beat the market.” To beat the market in any given year, an investor must earn a rate of return greater than the rate of return of some market basket of stocks, such as the Dow Jones Industrial Average
> Toxic Epidermal Necrolysis (TEN), also known as Lyell’s syndrome, is a life- threatening disease characterized by blisters that cover the skin and extensive peeling off of skin. In a double-blind, randomized, placebo- controlled study of the effects of a
> The negative binomial probability distribution can be used to compute the probability of the random variable X, the number of trials necessary to observe r successes of a binomial experiment. The probability distribution function is given by Consider a r
> A probability distribution for the random variable X, the number of trials until a success is observed, is called the geometric probability distribution. It has the same criteria as the binomial distribution (see page 313), except that the number of tria
> When taking a systematic random sample of size n, every group of size n from the population has the same chance of being selected.
> According to the High School Athletics Participation Survey, approximately 55% of students enrolled in high schools participate in athletic programs. You are performing a study of high school students and would like at least 11 students in the study t
> Historically, the probability that a passenger will miss a flight is 0.0995. Source: Passenger-Based Predictive Modeling of Airline No-show Rates by Richard D. Lawrence, Se June Hong, and Jacques Cherrier. Airlines do not like flights with empty seats, b
> In an election for President of the United States, a pollster wishes to predict the winner of the popular vote. She will do this by taking a random sample of 1000 voters and ask each to disclose who he/she will vote for. Assume the election is a dichotom
> The following excerpt is from the Racial Profiling Data Collection Resource Center. In 2006, the New York City Police Department stopped a half- million pedestrians for suspected criminal involvement. Raw statistics for these encounters suggest large rac
> In May, 2000, the Gallup Organization reported that 11% of adult Americans had a great deal of trust and confidence in the federal government handling domestic issues. Suppose a survey of a random sample of 1100 adult Americans finds that 84 have a great
> In March 1995, The Harris Poll reported that 80% of parents spank their children. Suppose a recent poll of 1030 adult Americans with children finds that 781 indicated that they spank their children. If we assume parents’ attitude toward spanking has not
> Clarinex-D is a medication whose purpose is to reduce the symptoms associated with a variety of allergies. In clinical trials of Clarinex-D, 5% of the patients in the study experienced insomnia as a side effect. (a) If 240 users of Clarinex-D are randoml
> In the Healthy Handwashing Survey conducted by Bradley Corporation, it was found that 64% of adult Americans operate the flusher of toilets in public restrooms with their foot. (a) If 500 adult Americans are randomly selected, how many would we expect t
> In a recent poll, the Gallup Organization found that 45% of adult Americans believe that the overall state of moral values in the United States is poor. (a) Compute the mean and standard deviation of the random variable X, the number of adults who believ
> According to flightstats.com, American Airlines flights from Dallas to Chicago are on time 80% of the time. Suppose 100 flights are randomly selected. (a) Compute the mean and standard deviation of the random variable X, the number of on-time flights in
> A(n)_____sample is obtained by dividing the population into homogeneous groups and randomly selecting individuals from each group.
> According to paint manufacturer DuPont, 6% of all cars worldwide are red. In the Sullivan Statistics Survey, of 175 respondents, 17, or 9.7%, indicated the color of their car is red. Determine if the results of the Sullivan Survey contradict those of DuP
> Twelve jurors are randomly selected from a population of 3 million residents. Of these 3 million residents, it is known that 45% are Hispanic. Of the 12 jurors selected, 2 are Hispanic. (a) What proportion of the jury described is Hispanic? (b) If 12 jur
> According to a study done by Nick Wilson of Otago University Wellington, the probability a randomly selected individual will cover his or her mouth with a tissue, handkerchief, or elbow (the method recommended by public health officials) when sneezing is
> According to a study done by Nick Wilson of Otago University Wellington, the probability a randomly selected individual will not cover his or her mouth when sneezing is 0.267. Suppose you sit on a bench in a mall and observe people’s habits as they sneez
> Clarinex-D is a medication whose purpose is to reduce the symptoms associated with a variety of allergies. In clinical trials of Clarinex-D, 5% of the patients in the study experienced insomnia as a side effect. A random sample of 20 Clarinex-D users is
> In the Healthy Handwashing Survey conducted by Bradley Corporation, it was found that 64% of adult Americans operate the flusher of toilets in public restrooms with their foot. Suppose a random sample of n = 20 adult Americans is obtained and the number
> In a recent poll, the Gallup Organization found that 45% of adult Americans believe that the overall state of moral values in the United States is poor. Suppose a survey of a random sample of 25 adult Americans is conducted in which they are asked to dis
> According to flightstats.com, American Airlines flights from Dallas to Chicago are on time 80% of the time. Suppose 15 flights are randomly selected, and the number of on-time flights is recorded. (a) Explain why this is a binomial experiment. (b) Determ
> n = 9, p = 0.8
> n = 10, p = 0.5
> What is random sampling? Why is it used and how does it compare with convenience sampling?
> Number of siblings
> Following the 2018 national midterm election, 18% of the governors of the 50 United States were female. Source: National Governors Association
> Create a file using any word-processing program or text editor. Write an application that prompts the user for the filename and displays the file’s path, name, folder, size, and time of last modification. Save the file as FileStatistics.java.
> Create a ScoreException class that extends Exception and whose constructor accepts a String parameter and passes it to the Exception class constructor. Save the file as ScoreException.java. b. Write an application in which you store at least five student
> Create a UsedCarException class that extends Exception; its constructor receives a value for a vehicle identification number (VIN) that is passed to the parent constructor so it can be used in a getMessage() call. Save the class as UsedCarException.java.
> Create a CourseException class that extends the Java Exception class and whose constructor receives a String that holds a college course’s department (for example, CIS), a course number (for example, 101), and a number of credits (for example, 3). Save t
> Write an application that prompts the user to enter an integer and displays its square root. Accept the user’s entry as a String using the nextLine() method. Then try to use the Integer.parseInt() method to convert the String to an integer. If the conver
> Write a program that prompts the user to enter an integer that represents an array size. Java generates a NumberFormatException if the user attempts to enter a noninteger value using nextInt(). Handle this exception by displaying an appropriate error mes
> Write a program that accepts a number of quarts from a user and converts the value to gallons. Include exception-handling capabilities in the program so that while any nonnumeric value is entered, the program continually displays an error message, reprom
> The Double.parseDouble() method requires a String argument, but it fails if the String cannot be converted to a floating-point number. Write an application in which you try accepting a double input from a user and catch a NumberFormatException if one is
> In a “You Do It” section of this chapter, you created a CalculatorDemo program that asked the user to solve an arithmetic problem and provided the Windows system calculator for assistance. Now modify that program to include the following improvements: ❯❯
> Throughout the Case Problems in this course, you have been using an Event class to store data about events for Yummy Catering. Now, create an application that prompts the user for details about eight Event objects, and create a data file that contains ea
> Serendipity Gifts accepts user orders for its products interactively. Users might make the following errors as they enter data: ❯❯ The item number ordered is not numeric, too low (less than 0), or too high (more than 9
> Create a DataEntryException class whose getMessage() method returns information about invalid integer data. Save the file as DataEntryException.java. b. Write a program named GetIDAndAge that continually prompts the user for an integer ID number and an
> Write an application named BadSubscriptCaught in which you declare an array of eight first names. Write a try block in which you prompt the user for an integer and display the name in the requested position. Create a catch block that catches the potentia
> The Talk-A-Lot Cell Phone Company provides phone services for its customers. Create an abstract class named PhoneCall that includes a String field for a phone number and a double field for the price of the call. Also include a constructor that requires a
> Create an abstract class named Book. Include a String field for the Book’s title and a double field for the book’s price. Within the class, include a constructor that requires the book title, and add two get methods—one that returns the title and one tha
> Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains fields for a number of samples, a description of the type of rock, and the weight of the rock in grams. Inc
> Create a class named Pizza with a String array data field that can hold the names of up to 10 pizza toppings. Also include a field for the price. Include a constructor that takes two parameters: the array of toppings and the number of toppings stored in
> Create a class named BaseballGame that contains data fields for two team names. Include a two-dimensional array that can hold the scores for each of two teams in each inning of the game. The BaseballGame class includes a final int that represents the n
> Create a class named Poem that contains fields for the name of the Poem and the number of lines in it. Include a constructor that requires values for both fields. Also include get methods to retrieve field values. Save the file as Poem.java. b. Create th
> Create a TeeShirt class for Tamjeed’s Tee Shirt Company. Fields include an order number, size, color, and price. Create set methods for the order number, size, and color, and create get methods for all four fields. The price is determined by the size: $2
> In Chapter 9, you created an interactive LessonWithRentalDemo class that obtains data for four rentals from Sunshine Seashore Supplies, including details about the contract number, length of the rental, and equipment type. After data entry, the applicati
> Create a class named Candle for a candle-making business. Include data fields for color, height, and price. Create get methods for all three fields. Create set methods for color and height, but not for price. Instead, when height is set, determine the pr
> Create a record named Inventor that stores two Strings: the name of an inventor and the inventor’s country of origin. Save the file as Inventor.java. b. Create an Invention class with three fields: a String description of the invention, an Inventor objec
> Create an interface called Runner. The interface has an abstract method called run(). Save the file as Runner.java. b. Create classes called Machine, Athlete, and PoliticalCandidate that all implement Runner. The run() method displays a message describin
> Create an abstract class called GeometricFigure. Each figure includes a height, a width, and a String figure type. Include an abstract method to determine the area of the figure. Save the file as GeometricFigure.java. b. Create two subclasses of Geometr
> Create an interface named Turner, with a single method named turn(). Save the file as Turner.java. b. Create a class named Leaf that implements turn() to display Changing colors. Create a class named Page that implements turn() to display Going to the ne
> Create a class named Blanket with fields for a Blanket’s size, color, material, and price. Include a constructor that sets default values for the fields as Twin, white, cotton, and $30.00. Include a set method for each of the first three fields. The meth
> Create an abstract Division class with fields for a company’s division name and account number, and an abstract display() method. Use a constructor in the superclass that requires values for both fields. Save the file as Division.java. b. Create two sub
> Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these fields. Save the file as Horse.java. b. Create a subclass of Horse named RaceHorse, which contains an additional field that ho
> Create a class named Purchase. Each Purchase contains an invoice number, amount of sale, and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set method for the sale amount, calculate the sales tax as 5 percent
> Create a personal phone directory that contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the first 10 people. Prompt the user for a name, and if the name is found in the list, display the corresponding phon
> In Chapter 9, you created a DinnerEventDemo class that obtains user data for an array of dinner events for Yummy Catering and allows the user to sort the events using various criteria. Now, modify the application so that it becomes immune to user data en
> Write an application that allows a user to enter the names and birthdates of up to 10 friends. Continue to prompt the user for names and birthdates until the user enters the sentinel value ZZZ for a name or has entered 10 names, whichever comes first. Wh
> Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Save the file as CollegeCourse.java. b. Cre
> Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a double annual sales amount. Methods include a constructor that requires values for both data fields, as well as get and set methods for each of the data fiel
> Create an application that prompts a user for 10 integers and stores them in an array. The application should call five methods that in turn (1) display all the integers, (2) display all the integers in reverse order, (3) display the sum of the intege
> Write an application for Chapa’s Car Care Shop that shows a user a list of available services: oil change, tire rotation, battery check, or brake inspection. Allow the user to enter a string that corresponds to one of the options, and display the option
> Allow a user to enter any number of double values up to 15. The user should enter 99999 to quit entering numbers. Display an error message if the user quits without entering any numbers; otherwise, display a count of the numbers entered, the arithmetic a
> Create a program with an enumeration that contains the names of the eight planets in our solar system. Prompt the user for a planet name and use the ordinal() method to display the planet’s position. Save the file as Planets.java.
> Create an application that contains an enumeration that represents the days of the week. Display a list of the days, and then prompt the user for a day. Display business hours for the chosen day. Assume that the business is open from 11 to 5 on Sunday, 9
> Write an application that stores at least five different college courses (such as CIS101), the time it first meets in the week (such as Mon 9 am), and the instructor (such as Khan) in a two-dimensional array. Allow the user to enter a course name and dis
> Radio station KJAVA wants a class to keep track of recordings it plays. Create a class named Recording that contains fields to hold methods for setting and getting a Recording’s title, artist, and playing time in seconds. Save the file as Recording.java.
> In Chapter 8, you created a Rental class for Sunshine Seashore Supplies. Now extend the class to create a LessonWithRental class. In the extended class, include a new boolean field that indicates whether a lesson is required or optional for the type of e
> The mean of a list of numbers is its arithmetic average. The median of a list is its middle value when the values are placed in order. For example, if an ordered list contains 1, 2, 3, 4, 5, 6, 10, 11, and 12, then the mean is 6, and their median is 5. W
> Write an application containing an array of 15 String values. Accept any number of Strings up to 15 from a user, and display them in ascending order. Save the file as StringSort.java.
> Each week, the Pickering Trucking Company randomly selects one of its 30 employees to take a drug test. Write an application that determines which employee will be selected each week for the next 52 weeks. Use the Math.random() function explained in Appe
> Write an application that stores nine integers in an array named numbers. Display the integers from first to last, and then display the integers from last to first. Save the file as NineInts.java.
> Write an application that accepts up to 20 Strings, or fewer if the user enters a terminating value. Store each String in one of two lists—one list for short Strings that are 10 characters or fewer and another list for long Strings that are 11 characters
> Write an application that accepts a word from a user and converts it to Pig Latin. If a word starts with a consonant, the Pig Latin version removes all consonants from the beginning of the word and places them at the end, followed by ay. For example, cri
> Three-letter acronyms are common in the business world. For example, in Java you use the IDE (Integrated Development Environment) in the JDK (Java Development Kit) to write programs used by the JVM (Java Virtual Machine) that you might send over a LAN (l
> Write an application that accepts three Strings from the user and, without regard to case, appropriately displays a message that indicates whether the Strings were entered in alphabetical order. Save the file as Alphabetize.java. b. Write an application
> Write an application that counts the words in a String entered by a user. Words are separated by any combination of spaces, periods, commas, semicolons, question marks, exclamation points, or dashes. Figure 7-17 shows a typical execution. Save the file