Student.java and fills the contents from your main method as follows. class Student{ String name; int ID; t then creates another file called GradStudent.java and fills the contents as follows class GradStudent extends Student String major; boolean thesis; } class Student{ String name; int ID; }
Q: What is wrong in the following code? class TempClass { int i; public void TempClass(int j) { i…
A: About wrong in the given code
Q: this is the whole problem i did 1 to 3 im stuck at 4 Create a class called Student, with the…
A: The answer is given below-
Q: Which class variable in class MyC. cannot be inherited by class xxx? class MyC: X,y=3,4%3;…
A: Inheritance is a property of accessing the properties of a parent class Here, MyC is the parent…
Q: 11. Implement a class to represent a playing card. Your class should have the following methods:…
A:
Q: Change the Fraction class so that its instance variables (numerator and denominator) are hidden…
A: Basic mistake here is that there were two classes in which main method is present. Hence one…
Q: Write the method whatIsThisObject. whatIsThisObject accepts a single Object as a parameter, and…
A: Solution: Given,
Q: In a Java program • Create a class named "Car" The class has the following states/fields/or…
A: Programming instructions: Include necessary header files. Create a Car class. In the class, declare…
Q: Consider the following code: class Player { private: string ID; string name; public:…
A: A class is a group of objects which have common properties. A constructor is a method that is used…
Q: Write a class Account in Python that stores information about a bank account. (a) Your class should…
A: Program class Bank_Account: def __init__(self): self.balance=0 print("Welcome to…
Q: Assume that a class exists called 'Student' with the following fields: int myID, double myGPA, and…
A: Explanation:- The priority queue is storing the data on the basis of reverse GPA order. After that…
Q: Create a class named Employee with a method information. Then take the input of n number of…
A: CODE FOR THE ABOVE QUESTION import java.util.Scanner; import java.io.*; import java.io.file; public…
Q: Q. Run and find output • class Name: • def _init_(self, FName, mi, LName): self. FName = FName…
A: class Name: def_init__(self, FName, mi, LName) self.FName = FName self.mi = mi…
Q: For the “Class C”: There is 2 ways for fixing this functions. Firstly fix the “yaz” and “yaz2” error…
A: The given code is in C++ language with inheritance where 1) Class A is parent class 2) Class B…
Q: Consider the following code: class Player { private: string ID; string name; public:…
A: Here is the explanation about the access method in the given classes:
Q: Write is the output of the following program with explanation? interface A { } class C
A: interface A { } Interface is called as blueprint of a class by default all the methods are abstract…
Q: What is the value of finalAmount after executing the following code? ( Assume each class is defined…
A: Required:
Q: e in java 1. Create a class called Student, with the following attributes/variables: a. studentName…
A: We need to create the Student and MyFriends classes as per the given description.
Q: Write a class named NameAndCount for recording a String data name and an int data named count. A…
A: The NameAndCount class implements a Comparable interface. An interface is a class that contains the…
Q: / Is my code correct? //please make it more efficient as you can. Thank you //please correct it if…
A: Solution: error free and successfully executed program is following - Programming language -…
Q: e a class called Word with the fields word (string) and guessed (list of guessed letters). ●…
A: We need to define the Class Word as per the given description.
Q: Predict the output of the following code: public class MyClass extends Test { public static void…
A: working: The code is used to print the value of the method num() present in the classes Test and…
Q: Begin with the following code, and the class you defined in #1 (you can assume it works even if you…
A: 1) Create an ArrayList(java) or List(C#) called Deck of PlayingCard(the class you defined in the…
Q: 1. Create a class Doll with one attribute name of type String. Include set for attribute name. Doll…
A: class Doll: package bartleby; public class Doll { private String name; public Doll() { name=""; }…
Q: Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the…
A: ALGO:- (I) input number of teamwins and teamlosses. (II) implement formula=…
Q: See ERROR in Java file 2:
A: You cannot write a method inside a method like we write inner classes So, to implement a new method,…
Q: As a starting point, use the files fraction.h, fraction.cpp, testfraction.cpp below: //…
A: Coded using C++.
Q: Create a new java project named CH46EX 1. Create a class named Student 1. 2 private instance data…
A: Working code: class student{ private String name; private long id; final static…
Q: Write a Java program called Process marks (using files). The program must read the marks of…
A: The complete answer is given below with output .
Q: Consider the following class definition. What are the methods of this Student class? class Student:…
A: Any function in Python starts with keyword def. def __init__() is the constructor of the class…
Q: Use a Bootstrap class to center the following text: Hello World!
A: Ans : Use a Bootstrap class to center the following text: <p class="text-center">Hello…
Q: Q3)What is the o/p of following program? public class MyClass { public static void main(String[]…
A: To be determine: Select right option Given code: public class MyClass { public static void…
Q: Consider the following code: class Player { private: string ID; string name; public:…
A: Actually, object is a instance of class.
Q: What will be the output of the following code? interface Test { int x = 10; } public class MyClass…
A: Given, Java code: interface Test {int x = 10;}public class MyClass implements Test{public void…
Q: the provided Book class in the file hw05_q2.py, create a container class called ShoppingList to…
A: It is defined as a collection of information that is organized so that it can be easily accessed,…
Q: int main() { Player golfer("Tiger Woods", "123456789"); BasketballPlayer…
A: The answer is given below
Q: 2. In the code below, classes A and B are in the same package. If the question marks are replaced by…
A: There are four access modifiers in Java Private: The access level of this modifier is only within…
Q: You have a file Train.java and you have a driver class named Map.java. Fill in the correct…
A: The answer is given below.
Q: Describe the code : Player(n, i) at the end of the BasketballPlayer constructor. a. calls the…
A: Answer:- A) calls the Player constructor with parameters n, i
Q: Fill in the memory spaces as you trace the code from the beginning of the code to linc 17. Duc to…
A: public class Q4_1{ public static coid main(string[ ] args){ int [ ] var1={1,2}; int var2=0;…
Q: It is the method of hiding certain elements of the implementation of a certain class? Select one: O…
A: Encapsulation - It is basically the binding of data methods and variables in a single unit like a…
Q: Complete the Course class by implementing the find_student_highest_gpa() instance method, which…
A: Please find the code and output below
Q: Write a class named NameAndCount for recording a String data name and an int data named count. A…
A: The interface is a class that contains the declarations of the methods and the definition of the…
Q: 5). What will be the output of the following code? interface Test { int x = 10; } public class…
A: Answer:-(C) compilation error
Q: inherits from Spy parent class one public method decode(input_file_name, input_directory,…
A: The Code of following is given below.
Q: Consider the following code: class Player { private: string ID; string name; public:…
A: Given, Player golfer("Tiger Woods", "123456789"); // line 2 BasketballPlayer…
Q: What is the output of the following code? ( Assume each class is defined in a separate java file).…
A: According to the Question below the solution:
Q: Write two Java classes: Student and Main as follow: Class Student: A. Create three private…
A: (1)First we need to define a Student class with the attributes Name, ID and Specialization (2)In…
Q: class overload { int x; double y; void add(int a { x = a + b; } void add(double c, double d) { y - c…
A: Given, Code: class overload { int x; double y; void add(int a , int b) {…
Q: erson class. Your class must have the following features: Student - major: String + Student() +…
A: Given : Student inherited from Person class
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
- This code is in java.codeHS under Classes and Object-Oriented Programming Personal Information: You will create a driver file called personalInfo.java It will ask if you are a person (super class), teacher, or student. (sub classes) If a person, you will ask them (using scanner) to enter their First Name, Last Name, Street Address and Phone Number (all should be strings.) If they are a teacher, they will enter all the person info, plus the number of years teaching as an int.(scanner) If they are a student, they will enter all the person info, plus year of graduation as an int and GPA as a double.(scanner) Each class should have a default constructor that initializes strings to a blank string and all ints or doubles to 0. You should then have an overloading constructor that takes in the information. Remember sub-classes inherit the super classes constructor. All three classes will then have an overriding method named printInfo. That prints out all of the appropriate…Basic Java Help Each year, the Social Security Administration provides a list of baby names for boy and girls by state. You will write a program to read a file containing a list of baby names and display the top names. To start, implement the following class: baby names util = printTopNames(File, int): void printTopNames Will be a static method. It will accept two parameters, one is a File containing the list of names. The other is an integer that indicates how many names to display (ie, top 10 names, or top 50 names, etc). The integer argument could be any valid integer. You do not have to worry about an integer value large than 5 for the boy/girl names. This method should open the file and parse the file and print the names as shown below: Your program will use the Scanner class to read the data from the file (see your text for examples). You will also need to use a delimiter with the scanner so that the scanner will break the line apart based on the commas. For this file, set…A mountain climbing club maintains a record of the climbs that its members have made. Information about a climb includes the name of the mountain peak and the amount of time it took to reach the top. The information is contained in the ClimbInfo class as declared below. The ClimbingClub class maintains a list of the climbs made by members of the club. The declaration of the ClimbingClub class is shown below. You will write implementations of the addClimb method. import java.util.List; import java.util.ArrayList; class ClimbInfo { private String name; private int time; /** Creates a ClimbInfo object with name peakName and time climbTime. * * @param peakName the name of the mountain peak * @param climbTime the number of minutes taken to complete the climb */ public ClimbInfo(String peakName, int climbTime) { name = peakName; time = climbTime; } /** @return the name of the mountain peak */ public String getName() { return name; } /** @return the number of minutes…
- 6. Design a Java class with a main method that does the following. You must include a meaningful comment for main and each method a. Main invokes a method readScores to read input from a file (name of your choice) that contains the name of the bowlers (no more than 25) and their bowling scores (two scores per bowler). The program stops reading values when it has reached the end of the file. For example, the file might contain: Bob 203 176 Jane 210 253 Jack 300 189 Eileen 220 298 • As the method reads the data, it stores the name into a String array and the average of the two bowling scores into an array of double. • The method returns the actual number of bowlers read in b. Main then invokes a method computeOverallAvg to: compute (a) the overall average score of all the bowlers combined, (b) the average score and name of the bowler with the highest average score and (c) the average score and name of the bowler with the lowest average scores. print to the console (a) the overall average…Exercise 1: Write a Java application that simulates a test. The test contains at least five questions about first three lectures of this course. Each question should be a multiple-choice question with 4 options. Design a Test class. Use programmer-defined methods to implement your solution. For example: create a method to simulate the questions – simulateQuestion create a method to check the answer – checkAnswer create a method to display a random message for the user – generateMessage create a method to interact with the user - inputAnswer Display the questions using methods of JOptionPane class. Use a loop to show all the questions. For each question: If the user finds the right answer, display a random congratulatory message (“Excellent!”,”Good!”,”Keep up the good work!”, or “Nice work!”). If the user responds incorrectly, display an appropriate message and the correct answer (“No. Please try again”, “Wrong. Try once more”, “Don't give up!”, “No. Keep trying..”). Use…Java Programming: Below is the lexer, shank and token files along with the shank.txt file. The shank file is the main method file. The lexer must break up the input text stream into lexemes and return a token object for each one in the shank.txt file. Make sure to fix the errors in the lexer.java file and show the complete code for lexer.java.There must be no error in the code at all. Run the whole code and show the output which the shank.txt must be printed out in the terminal. Attached is the rubric. Lexer.java package mypack; import java.util.HashMap;import java.util.List;import mypack.Token.TokenType; public class Lexer { private static final int INTEGER_STATE = 1;private static final int DECIMAL_STATE = 2;private static final int IDENTIFIER_STATE = 3;private static final int SYMBOL_STATE = 4;private static final int ERROR_STATE = 5;private static final int STRING_STATE = 6;private static final int CHAR_STATE = 7;private static final int COMMENT_STATE = 8; private static final…
- NOTE: The Array, ArrayList or List class may not be used Write a program that will create an invoice for a customer order based on their requests. Your program should prompt the user for their requested items based on a stock number then store the associated information in an array to be displayed in the invoice. 1. Define a Java class as described below. All variables should be declared as private and all methods as public. Save the class definition in a file with an appropriate filename. Class Name: Inventory Instance Variables: itemName - String price - double quantity - integer Instance Methods: A default constructor A constructor that accepts three arguments, one for each of the fields. getter methods for each of the class fields. toString() A method to display the fields of an instance of the class in to be displayed on the order sheet. Compile and debug the above code. 1. Then, create a class, TestInventory that contains a main() with static methods to create an invoice using…You need 5 java classes and these include Netflix Class (Parent class of Movie and TVShow class) Movie Class TVShow Class Test/TestDriver Class Database Class Please read the questions carefully. TestDriver is given for the other image.required program java Create a class called DuplicateCounter. Create an instance method called count that takes a single parameter called dataFile (representing the path to a text file) and uses a Map of Strings to count how many times each word occurs in dataFile. The counts should be stored in an instance variable called wordCounter. Create an instance method called write that takes a single parameter called outputFile (representing the path to a text file) and writes the contents of wordCounter to the file pointed to by outputFile. The output file should be overwritten if it already exists, and created if it does not exist. Create a separate class called Application that contains a main method which illustrates the use of DuplicateCounter by calling both the remove and write methods. Your input file must be called problem2.txt and your output file must be called unique_word_counts.txt.
- Object Oriented Programming: 213COMP, 214COMP (Feb-2022) Assignment- I [10 marks] Academic honesty: O Only pdf file accepted & student ID, will be your upload file. O Student who submit copied work will obtain a mark of zero. O Late work or attach file by email message not allowed. Q1: Write the signature for a method that has one parameter of type String, and does not return a value. Q2: Write the signature for a method that has two parameters, both of type Student, and returns an int value. Q3: Write the constructor's headers of the followings? new Student (202101156, “Ahmed"); new Address(51, "jazan university","CS&IT" ); new Grade(true, 505235600, 4.5); Q4: a) Write a class Student that define the following information: name, stid , age. b) Explain a mutators (setters) and accessors(getters) methods for each attributes(fields). c) Add three constructors: • with empty constructor. one parameter constructor (name of student) two parameters constructor (name and stid) d) Create two…IN JAVA The class Movie is started below. An instance of class Movie represents a film. This class has the following three class variables: • title, which is a String representing the title of the movie • releaseYear, which is an int representing the year in which the movie was released • rating, which is a double representing a rating of the movie (just assume it’s from IMDB) Create a class first. After that, add the following to your class: a) Write a constructor for the class Movie, which takes a String representing the title of the movie, an int representing the year the movie was released, and a double representing the rating as its arguments, and sets the respective class variables to these values. b) Write a second constructor for the class Movie, which takes a String representing the title of the movie and an int representing the release year, and sets the respective class variables to these values, while the class variable rating is set to 0. c) Create a variable that…In Python Write a program that computes a patient's bill for a hospital stay. The different components of the program are • The PatientAccount class will keep track of the patient's charges. It will keep track of the number of days spent in the hospital. • The surgery method will have the charges for at least five types of surgery. It will update the charges member variable. A data file will contain at least five types of surgery and its cost. Both type and cost will be separated by commas. • The pharmacy method will have the charges for at least five types of medication. It will update the charges member variable. A data file will contain at least five types of medication and its cost. Both type and cost will be separated by commas • The dayCharge method will update the days sent member variable. • Each day in the hospital costs $1,000 The program will have a menu that allows the user to enter a type of surgery, enter one or many types of medication, number of days in the hospital and…