Concept explainers
What error message do you see in the Code Pad if you type the following?
Take a careful look at this error message and try to remember it because you will likely encounter something similar on numerous future occasions. Note that the reason for the error is that the class name, NumberDisplay, has been used incorrectly to try to call the getValue method, rather than the variable name nd.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Additional Engineering Textbook Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Artificial Intelligence: A Modern Approach
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
- You are responsible for adding the appropriate testing code to your main. a. The getValedictorian method returns the valedictorian of the class, that is the student with the highest grade point average. Implement this new method. b. The getHonorsPercent method returns the percentage of students in the class who are in the honors program. Use 3.75 as the cutoff GPA. Implement this method. Also print the list of students, by using the isHonor method, in the Honors program. c. An alternate implementation for the School class is being considered, in which the students are stored in an ArrayList instead of an array. Show how the declaration of the data field students would look in this alternate design. MAIN CLASS: import java.util.ArrayList; public class Main { public static void main(String[] args) { System.out.println("Unit07Project2 by Your Name"); System.out.println(); int size = 10; School onw = new School(size); /* Add the code…arrow_forwardWhat error message do you see in the Code Pad if you type the following? nd.setValue(int 5); The error message is not actually very helpful at all. Can you work out what is incorrect about this call to setValue, and correct it? It would also be worth remembering this error message because it results from an easy error to make in the early stages of learningarrow_forwardPlease check images for the rest of the question and provide code with comments and explanations. Thank you. Write a set of static methods, to make console input simpler. Consider that the only console input method using the Scanner class is inputString(), shown below; include it in your solution. This means you are not permitted to use the Scanner class in any of your methods. public static String inputString (){Scanner scan = new Scanner (System.in); // attach to consolereturn ( scan.next() ); // return next string from input console stream}Example of calling and testing this method in your main():String str = inputString(); // get input from console, assign to strdisplayln ("Input A is: " + str); // display input stringdisplayln ("Input B is: " + inputString() ); // get input and displayarrow_forward
- Is there a way to stop people from messing with the class fields?arrow_forwardShare at least three tasks that you know WinMain (starting) method handles.arrow_forwardThe following code is poorly structured. Rewrite it so that it has a better structure and avoids redundancy. To help eliminate redundancy, convert the code into a method named spending that accepts two parameters: a Scanner for the console, and a String for a single person's name, and prints the appropriate information about that person's bills. Your method could be called twice (once for John and once for Jane) to replicate the original code's behavior.arrow_forward
- Please complete the code as given!arrow_forwardWrite the code for the timeTick method in ClockDisplay that displays hours, minutes, and seconds, or even implement the whole class if you wish.arrow_forwardCopy your previous class definition for RectangularSolid from the previous problem, including both methods. Provide mutators (setters) and accessors (getters) for each of the three parameters. Use the naming convention for these methods that is demonstrated in your textbook (i.e. do not use the property function or decorators). These methods should allow a program using your code to modify the parameter values after creation and to read individual parameter values.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education