Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 10, Problem 5PC
Course Grades
In a course, a teacher gives the following tests and assignments:
- A lab activity that is observed by the teacher and assigned a numeric score.
- A pass/fail exam that has 10 questions. The minimum passing score is 70.
- An essay that is assigned a numeric score.
- A final exam that has 50 questions.
Write a class named CourseGrades. The class should have a GradedActivity array named grades as a field. The array should have four elements, one for each of the assignments previously described. The class should have the following methods:
setLab: | This method should accept a GradedActivity object as its argument. This object should already hold the student’s score for the lab activity. Element 0 of the grades field should reference this object. |
setPassFai1 Exam: | This method should accept a PassFailExam object as its argument. This object should already hold the student’s score for the pass/fail exam. Element 1 of the grades field should reference this object. |
setEssay: | This method should accept an Essay object as its argument. (See |
setFinal Exam: | This method should accept a FinalExam object as its argument. This object should already hold the student’s score for the final exam. Element 3 of the grades field should reference this object. |
toString: | This method should return a string that contains the numeric scores and grades for each element in the grades array. |
Demonstrate the class in a program.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C# Windows Application
Tic-Tac-Toe Simulator- Create an application that simulates a game of tic-tac-toe. Figure 7-49 shows an example of the application’s form. The form shown in the figure uses eight large Label controls to display the Xs and Os.
The application should use a two-dimensional int array to simulate the game board in memory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element. The number 0 represents the letter O, and the number 1 represents the letter X. The form should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie.
Complete the following tasks:
Design a class named StockTransaction that holds a stock symbol (typically one to four characters), stock name, and price per share. Include methods to set and get the values for each data field. Create the class diagram and write the pseudocode that defines the class.
Design an application that declares two StockTransaction objects and sets and displays their values.
Design an application that declares an array of 10 StockTransactionobjects. Prompt the user for data for each object, and then display all the values.
Design an application that declares an array of 10 StockTransactionobjects. Prompt the user for data for each object, and then pass the array to a method that determines and displays the two stocks with the highest and lowest price per share.
JAVA PROGRAMMING OOP
The program will ask the user for some basic information (Name, Age, Address, etc.) then the program will store these in variable that can be used in other java classes. In a different class make it so that the method will accept an array of the user information. Then check if the user's name and address match those found in an array if they match then output "User not eligible for NBI Clearance" else print vice- versa. The main class will inherit the previously described class and call on the method to check if the user is eligible.
Chapter 10 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 10.1 - Here is the first line of a class declaration....Ch. 10.1 - Look at the following class declarations and...Ch. 10.1 - Class B extends class A. (Class A is the...Ch. 10.2 - Prob. 10.4CPCh. 10.2 - Look at the following classes: public class Ground...Ch. 10.3 - Under what circumstances would a subclass need to...Ch. 10.3 - How can a subclass method call an overridden...Ch. 10.3 - If a method in a subclass has the same signature...Ch. 10.3 - If a method in a subclass has the same name as a...Ch. 10.3 - Prob. 10.10CP
Ch. 10.4 - When a class member is declared as protected, what...Ch. 10.4 - What is the difference between private members and...Ch. 10.4 - Why should you avoid making class members...Ch. 10.4 - Prob. 10.14CPCh. 10.4 - Why is it easy to give package access to a class...Ch. 10.6 - Look at the following class definition: public...Ch. 10.6 - When you create a class, it automatically has a...Ch. 10.7 - Recall the Rectangle and Cube classes discussed...Ch. 10.8 - Prob. 10.19CPCh. 10.8 - If a subclass extends a superclass with an...Ch. 10.8 - What is the purpose of an abstract class?Ch. 10.8 - If a class is defined as abstract, what can you...Ch. 10.9 - Prob. 10.23CPCh. 10.9 - Prob. 10.24CPCh. 10.9 - Prob. 10.25CPCh. 10.9 - Prob. 10.26CPCh. 10.9 - Prob. 10.27CPCh. 10.9 - Prob. 10.28CPCh. 10 - In an inheritance relationship, this is the...Ch. 10 - In an inheritance relationship, this is the...Ch. 10 - This key word indicates that a class inherits from...Ch. 10 - A subclass does not have access to these...Ch. 10 - This key word refers to an objects superclass. a....Ch. 10 - In a subclass constructor, a call to the...Ch. 10 - The following is an explicit call to the...Ch. 10 - A method in a subclass that has the same signature...Ch. 10 - A method in a subclass having the same name as a...Ch. 10 - These superclass members are accessible to...Ch. 10 - Prob. 11MCCh. 10 - With this type of binding, the Java Virtual...Ch. 10 - This operator can be used to determine whether a...Ch. 10 - When a class implements an interface, it must...Ch. 10 - Prob. 15MCCh. 10 - Prob. 16MCCh. 10 - Abstract classes cannot ___________. a. be used as...Ch. 10 - You use the __________ operator to define an...Ch. 10 - Prob. 19MCCh. 10 - Prob. 20MCCh. 10 - You can use a lambda expression to instantiate an...Ch. 10 - True or False: Constructors are not inherited.Ch. 10 - True or False: in a subclass, a call to the...Ch. 10 - True or False: If a subclass constructor does not...Ch. 10 - True or False: An object of a superclass can...Ch. 10 - True or False: The superclass constructor always...Ch. 10 - True or False: When a method is declared with the...Ch. 10 - True or False: A superclass has a member with...Ch. 10 - True or False: A superclass reference variable can...Ch. 10 - True or False: A subclass reference variable can...Ch. 10 - True or False: When a class contains an abstract...Ch. 10 - True or False: A class may only implement one...Ch. 10 - True or False: By default all members of an...Ch. 10 - // Superclass public class Vehicle { (Member...Ch. 10 - // Superclass public class Vehicle { private...Ch. 10 - // Superclass public class Vehicle { private...Ch. 10 - // Superclass public class Vehicle { public...Ch. 10 - Write the first line of the definition for a...Ch. 10 - Look at the following code, which is the first...Ch. 10 - Write the declaration for class B. The classs...Ch. 10 - Write the statement that calls a superclass...Ch. 10 - A superclass has the following method: public void...Ch. 10 - A superclass has the following abstract method:...Ch. 10 - Prob. 7AWCh. 10 - Prob. 8AWCh. 10 - Look at the following interface: public interface...Ch. 10 - Prob. 1SACh. 10 - A program uses two classes: Animal and Dog. Which...Ch. 10 - What is the superclass and what is the subclass in...Ch. 10 - What is the difference between a protected class...Ch. 10 - Can a subclass ever directly access the private...Ch. 10 - Which constructor is called first, that of the...Ch. 10 - What is the difference between overriding a...Ch. 10 - Prob. 8SACh. 10 - Prob. 9SACh. 10 - Prob. 10SACh. 10 - What is an. abstract class?Ch. 10 - Prob. 12SACh. 10 - When you instantiate an anonymous inner class, the...Ch. 10 - Prob. 14SACh. 10 - Prob. 15SACh. 10 - Employee and ProductionWorker Classes Design a...Ch. 10 - ShiftSupervisor Class In a particular factory, a...Ch. 10 - TeamLeader Class In a particular factory, a team...Ch. 10 - Essay Class Design an Essay class that extends the...Ch. 10 - Course Grades In a course, a teacher gives the...Ch. 10 - Analyzable Interface Modify the CourseGrades class...Ch. 10 - Person and Customer Classes Design a class named...Ch. 10 - PreferredCustomer Class A retail store has a...Ch. 10 - BankAccount and SavingsAccount Classes Design an...Ch. 10 - Ship, CruiseShip, and CargoShip Classes Design a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Describe the implementation of the method drawHere for a class called Diamond that is derived from the class Sh...
Java: An Introduction to Problem Solving and Programming (7th Edition)
Rewrite Programs 4.2 through 4.5, replacing all uses of the f statement with equivalent w statements. Run each ...
Programming in C
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Write a program that reads in two numbers typed on the keyboard and divides the first number by the second numb...
Absolute Java (6th Edition)
In Listing 5. 11, how many times the loop body is executed for a decimal number 245, and how many times the loo...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Using examples, illustrate the different types of adaptor needed to support sequential composition, hierarchica...
Software Engineering (10th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- For each of the following exercises, you may choose to write a console-based or GUI application, or both. Write a program named CheckZips that is used by a package delivery service to check delivery areas. The program contains an array that holds the 10 zip codes of areas to which the company makes deliveries. Prompt a user to enter a zip code, and display a message indicating whether the zip code is in the companys delivery area.arrow_forwardComputer Science C# Programming Object Orientation Please use Arrays or ArrayLists where appropriate Implement a menu driven program that has some operations for a food truck. A food truck has multiple food items as well as a menu which contains a selection of the food items which will be sold for that day. A maximum of 10 food items can appear on the menu for any day. For each food item keep a code, description, category, price and quantity in stock (code, description and category are not usually changed). Create a comma delimited text file called "items.txt" for 15 or more food items, indicating the item's description, category, price and quantity in stock. Read all the food items from the text file “Items.txt” Display all the food items available for this food truck. Continuously prompt the user for a food item’s code to be placed on the menu until the menu is full or the user enters -1. Note that only food items which have a positive quantity in stock may be added to…arrow_forwardAssignment 5C: Level Map Creator. There are a variety of ways that game developers store their level layouts. One simple method is to associate level elements with certain symbols, and then storing them in a 2D grid inside a text file. We will use our knowledge of 2D arrays to create a very simple Level Map Creator tool. The program should prompt the user to enter a width and height for the level. Then it should initialize a 2D array and fill every element with the *" symbol. Afterwards, the user should be given the following options via a menu: 1. Clear Level 2. Add Platform Prompt the user to enter a starting point and length for the Re-initialize the 2D array and fill every element with the "** symbol. horizontal platform. Replace those elements in the 2D array with the "=" symbol. If the length is longer than the number of columns |(or out of bounds), notify the user that this is not possible. Prompt the user to enter a column and row index. Replace that element in the 2D array…arrow_forward
- Assignment 5C: Level Map Creator. There are a variety of ways that game developers store their level layouts. One simple method is to associate level elements with certain symbols, and then storing them in a 2D grid inside a text file. We will use our knowledge of 2D arrays to create a very simple Level Map Creator tool. The program should prompt the user to enter a width and height for the level. Then it should initialize a 2D array and fill every element with the "*" symbol. Afterwards, the user should be given the following options via a menu: 1. Clear Level Re-initialize the 2D array and fill every element with the "*" symbol. 2. Add Platform Prompt the user to enter a starting point and length for the horizontal platform. Replace those elements in the 2D array with the "=" symbol. If the length is longer than the number of columns (or out of bounds), notify the user that this is not possible. 3. Add Item Prompt the user to enter a column and row index. Replace that element in the…arrow_forwardIn visual basic Write the code that will sequentially search through the array strFirstNames and will print out the word "Found" if the name "Brian" is in the array.arrow_forwardPlease submit a flowchart of your program for your project below. Need a class which will contain: Student Name Student Id Student Grades (an array of 3 grades) A constructor that clears the student data (use -1 for unset grades) Get functions for items a, b, and c, average, and letter grade Set functions for items a, n, and c Note that the get and set functions for Student grades need an argument for the grade index. Need another class which will contain: An Array of Students (1 above) A count of number of students in use You need to create a menu interface that allows you to: Add new students Enter test grades Display all the students with their names, ids, test grades, average, and letter grade Exit the program Add comments and use proper indentation. Nice Features: I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade. I would like the system to display the…arrow_forward
- Tic Tac Toe SimulatorCreate a GUI application that simulates a game of tic tac toe. Figure 13-35 shows an example of the application’s window. The window shown in the figure uses nine large JLabelcomponents to display the Xs and Os.One approach in designing this application is to use a two-dimensional int array to simulatethe game board in memory. When the user clicks the New Game button, the applicationshould step through the array, storing a random number in the range of 0 through 1 in eachelement. The number 0 represents the letter O, and the number 1 represents the letter X. TheJLabel components should then be updated to display the game board. The application shoulddisplay a message indicating whether player X won, player Y won, or the game was a tie.arrow_forwardComment block: Set up comments using the standard format in a <# and #> container, which should contain a synopsis, description, and at least one example which shows how to run the script. Set up an array: Put values in the array $ComputerNames, containing the names of two computers: DC1 and W10-CLIENT. Prompt for user's name: Use the text Please enter your first name, store the value the user will provide in a variable named $FirstName, and write out the text Hello followed by a space, followed by the name entered. Prompt for report type, and store value provided: Ask the user to enter AD if the information on Active Directory Users is required, and WMI for Windows Machine Instrumentation. Store the answer provided in variable $ReportType Confirm report selection: If an Active Directory report was requested, on a new line print the message "A list of all AD users was requested for computers " followed by the contents of the $ComputerNames array. If a Windows Machine…arrow_forwarda class with 10 students that will take 3 exams use 3 arrays to hold the scores for each student and anoither array to hold the average of the 3 exams for each student. Print the table with the scores and averagearrow_forward
- Using C# in Microsoft Visual Studio Create an application that simulates a game of tic-tac-toe. The application should use a two-dimensional int array to simulate the game board in memory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element.The number 0 represents the letter O, and the number 1 represents the letterX. The form should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie.arrow_forwardFor each object class include the following: displayPromotion () method which can be used to display the following messages:Video Game: Only certain of video game will be getting 10% discount.Sport Game: Booking court on week days will be getting 15% discount.Overridden toString() method that returns a string containing all the data fields’values.(photo 111) Write a driver program that uses a polymorphic array to store information for various video games and sport games. Use an array initializer to initialize the array with values. Then, display a list with all the game information. A sample output is provided below:(photo 112)arrow_forwardWeb2arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Program to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY