Question 5 (5 points) For the questions below: Assume this Student class: public class Student {...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 5 (5 points) For the questions below: Assume this Student class: public class Student { String name; int id; double mark1, mark2; Student (String n, int i, double m1, double m2) { name = n; id i; mark1 = m1; mark2 m2; } void info() { System.out.println("Id: "+id+" Name: "+name); } double sum( ) { return mark1 + mark2; } }//end class Student Answer the following questions. 1. Write the statement to instantiate an object for Student class as "myStu", and pass the parameters values as follows: name as Mary, id as 123, mark1 as 95, and mark2 as 100 2. Write a statement to print the "sum method" using Student class object. 3. Write a statement to print the "info method" using Student class object. 4. Add a constructor to class Student, which has 2 parameters, which is name and id. 5. Write a statement to instantiate a two parameter constructor with an object "myStu1" and pass the parameter value of name as Robin and id as 350. Question 5 (5 points) For the questions below: Assume this Student class: public class Student { String name; int id; double mark1, mark2; Student (String n, int i, double m1, double m2) { name = n; id i; mark1 = m1; mark2 m2; } void info() { System.out.println("Id: "+id+" Name: "+name); } double sum( ) { return mark1 + mark2; } }//end class Student Answer the following questions. 1. Write the statement to instantiate an object for Student class as "myStu", and pass the parameters values as follows: name as Mary, id as 123, mark1 as 95, and mark2 as 100 2. Write a statement to print the "sum method" using Student class object. 3. Write a statement to print the "info method" using Student class object. 4. Add a constructor to class Student, which has 2 parameters, which is name and id. 5. Write a statement to instantiate a two parameter constructor with an object "myStu1" and pass the parameter value of name as Robin and id as 350.
Expert Answer:
Answer rating: 100% (QA)
1 To instantiate an object for the Student class as myStu and pass the parameter values java Student ... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Chapter 6 Lab Methods Lab Objectives Be able to declare a new class Be able to write the constructor Be able to write instance methods that return a value Be able to instantiate an object Be able to...
-
Data set Theory Assume an informational record with one association parent including matches (a, b) where a can't try not to be a parent of b. (a) Write a Datalog demand which gives the graph of...
-
Many areas have attempted to increase the amount of recycled waste lubricating oil by requiring service stations to serve as collection centers or by instituting deposit-refund systems. On what...
-
Carl Corporation acquires a business use warehouse for $200,000 on January 2, 2009. From 2009 through 2014, Carl Corporation properly deducts a total of $30,000 in depreciation. Carl incurs a net...
-
Palmaro Corporation has been authorized to issue 20,000 shares of $100 par value, 10%, noncumulative preferred stock and 1,000,000 shares of no-par common stock . The corporation assigned a $2.50...
-
Determine whether each of the following statements is true or false: Managers three primary responsibilities are planning, directing, and controlling.
-
Suppose that you hate typing and hate filing. a. Draw a graph with "hours of typing" on the horizontal axis and "hours of filing" on the vertical. Do your indifference curves slope upward or...
-
Suppose that the supply curve of serving in the military is S(P) = P, where Q = S(P) is several hours employed in military service a day. There are only mercenaries in the army (there is no draft). P...
-
e Write XML file for the following project's screenshot. The project has one activity and displays the following: 1. The activity shows a login page with TWO TextView and TWO EditText and TWO...
-
3) What are the tax consequences if gifted his life insurance policy on 12/31/23: John would like to know the tax consequences and filing requirements if he gifts his life insurance equally to his...
-
You work for Procter and Gamble (P&G). One of the brands you manufacture is Tide Detergent. It sells for $10 per bottle at the grocery store. Chens Enterprises Corp. is P&G's Canadian distributor,...
-
uppose the price of a non-dividend paying stock is $50. There exist European call and put options on the stock with one year to maturity and the strike price $50. The call is worth $4.5 and the put...
-
You have access to a small professional telescope that is able to record the ultraviolet through infrared spectrum of a star in the constellation of Orion. You determine that the wavelength of light...
-
I need help to develop a $40,000 mutual fund portfolio. Using today's actual funds and actual quoted prices, invest as much of the $40,000 as you possibly can, and be specific! Briefly describe the...
-
20.23 The mutarotation of glucose is first order in glucose con- centration and is catalyzed by acids (A) and bases (B). The first- order rate constant may be expressed by an equation of the type...
-
If your school has a subscription to the FASB Codification, go to aaahq.org/ ascLogin.cfm to log in and prepare responses to the following. (a) What is the stock dividend? (b) What is a stock split?...
-
Create an app that displays a rectangle with a shadow and allows the user to control the shadow using Sliders. Investigate class DropShadow (package javafx.scene.effect). Use Node method setEffect to...
-
Reimplement Exercise 22.36. using Circles and Rectangles to represent the game elements and TransitionAnimations to move them. Class Shape provides static method intersect that can be used for...
-
Modify the payroll system of Figs. 10.410.9 to include private instance variable birth Date in class Employee. Use class Date of Fig. 8.7 to represent an employees birthday. Add get methods to class...
-
Scientists propose that the first macromolecules in protobionts were a. DNA molecules. b. RNA molecules. c. proteins. d. all of the above.
-
Which of the following function(s) is/are carried out by piRITS or piRISC? a. Inhibits transcription of TEs b. Causes the degradation of TE RNA c. Causes chromosome breakage d. Both a and b are...
-
In the CRISPR-Cas system, what does tracrRNA bind to? a. crRNA and Cas1 protein b. crRNA and Cas2 protein c. crRNA and Cas9 protein d. Cas1 and Cas2 proteins
Study smarter with the SolutionInn App