write a program to print the names of the student by creating a student class .if no name is passed while creating an object of the student class,then the name should be "unknown" ,otherwise the name should be equal to the string valaue passed while creating the object of the student class.
Q: Write a class RangeInput that allows users to enter a value within a range of values that is…
A: According to the information given:- we have to follow the instruction to get the desired outcome.…
Q: Set the last name only. Set the first name only. Set the middle name. Check whether a given last…
A: Note: Since you have not provided the language to write the code so I am using java language to…
Q: Implement a superclasS Person. Make two classes, Student and Instructor, that inherit from Person. A…
A: Programming instructions: Create a class Person. In a Person class, create required variables, a…
Q: Consider the class Students declaration and its constructor has two arguments (the data type of the…
A: Syntax for creating object of class. Classname object= new classname(parameters);
Q: Write a program by creating an 'Employee' class having the following methods and print the final…
A: /* Java program */import java.util.*; class EmployeeDetail { private String name; private float…
Q: Write an OOP program that include class named "Shape". Which has different variables like; int…
A: Here it is very simple program Create class Name Shape Attribute Length and width as private Set…
Q: Write a complete program that demonstrates the concept of overloading
A: In Java, two or more methods may have the same name if they differ in parameters (different number…
Q: Write a program to model the kinds of people one finds in a university. The categories are students,…
A: The following classes are used in the program. Person abstract class. Student class as a subclass…
Q: Write a program to swap the values of private data members of a class named as class_1 and class_2…
A: Friend Function in C++ is used to access private and protected data of a class. Using keyword…
Q: By implementing the concepts of Classes and Objects, write a C++ program that determines the…
A: Algorithm: Start Create a class Motion with v0,theta,t as its members using constructor and…
Q: Drag and drop from the options below to declare an object of type "People", which takes a string as…
A: Declare an object of type "People", which takes a string as the first parameter for its constructor…
Q: Provide a class for authoring a simple letter. In the constructor, supply the names of the sender…
A: The required program is as follows, File name: “Letter.java” //First the Letter class public class…
Q: write the definition of a class ContestResult containing: an instance variable winner of type…
A: The class ContestResult will have three instance variables winner, second_place, third_place and…
Q: Define a class Pet with two attributes, name (a string), and legs (an int). In Pet, define a show…
A: The approach and the python program are given below:Approach:Creating a class Pet.Now, defining the…
Q: Complete the FoodItem class by adding a constructor to initialize a food item. The constructor…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT…
Q: Write a program by creating an 'Employee' class having the following functions and print the final…
A: Required: To Write a program by creating an 'Employee' class having the following functions and…
Q: Write a C++ program to read two objects -lengths l1, l2 in the form of yards and foots by using a…
A: Programs: Programs are used to read the input from the user, process the input according to the…
Q: Draw a UML diagram of the following classes? The classes of this program represent an elevator.…
A: Provided the UML Diagram for the given classes. Attached the UML Diagram.
Q: public abstract class DebugBoat { String boatType = new String(); int passengers; String…
A: public abstract class DebugBoat{ String boatType = new String(); int passengers; String power…
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: Implement using Java Create an interface that shall have 2 methods and one string type attribute,…
A: I have added the comments in the code. Also, make sure to give the java file name Demo.java. If you…
Q: Write a resource class that has the deposit, withdrawal, and print balance methods. Next, write a…
A: Create a Resource class having three members depositedAmount, withdrawalAmount and balanceAmount.…
Q: Write a separate class BookDemo with a main() method that creates a Book object titled “Developing…
A: class Book{ private String name; private String author; private double price;…
Q: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: Start Input length Input breadth Create instance Set Dimensions Print Area Stop
Q: Given the following class. (JAVA) public class FamilyMember { public String drink( ) {return…
A: logic:- define a constructor taking age as parameter. set this.age=age create a method in baby…
Q: Take a look at the following class diagram, write Java code that simulate the two classes Student…
A: Inheritance can be defined as the process where we create new classes that are built upon existing…
Q: 1/ Implement a class Employee. An employee has a name (a string) and a salary (a double). Provide a…
A: Note: This is a multiple-question-based problem. The only first question is solved. Kindly send the…
Q: 1) Implement the class Director: The newContract method tells us that the director has new film; its…
A: Use getInstance method in Calendar to get the current time and we have to print this time with…
Q: Write a program by creating an 'Employee' class having the following methods and print the final…
A: Create Employee class. Inside Employee class initialize variable salary and hours. Add Given…
Q: Write a class RangeInput that allows users to enter a value within a range of values that is…
A: CODE TEXT SO YOU DON'T HAVE TO TYPE. public class RangeInput { private int currentValue;…
Q: Write a Python Program Implement the design of the Traveller class so that the following output…
A: 1) Below is program that implements the design of the Traveller class so that the following output…
Q: Write an OOP program that includes a class named "Shape". Next, create two objects from the class;…
A: class Shape{ public void print_shape(){ System.out.println("This is shape"); } } //…
Q: Write a program to print the area of rectangle by creating a class named "Rectangle" with…
A: public class Main{ public static void main(String[] args) { Rectangle r1=new Rectangle(12,13);…
Q: Write a Java program for a class named Baby. A Baby has a name of type String and an age of type…
A: Introduction of Java Program In this program, we have a default constructor that is used to…
Q: Write a class encapsulating the concept of a corporate name (for example, "IBM"), assuming a…
A: The given problem is related to java programming that will have 2 classes in it. corporate class…
Q: In python how do you: Complete the FoodItem class by adding a constructor to initialize a food item.…
A: class FoodItem: def __init__(self, name="None", fat=0.0, carbs=0.0, protein=0.0):…
Q: This assignment starts with the Account class from Labs 4 and 5. Our new and improved bank has two…
A: package inheritance; import java.util.*; class Bank { Scanner s=new Scanner(System.in);…
Q: Write a class RangeInput that allows users to enter a value within a range of values that is…
A: Given The answer is given below. CODE:- import java.util.Scanner; class RangeInput { static int…
Q: Write a java program to create a class 'simpleobject". Using constructor to display the message
A: Lets see the solution.
Q: Create a "tank" class and use it in a program that accepts height and radius from the user and…
A: The class tank will be created using the keyword class. The __init__ function will initialize the…
Q: WAKA, WAKA. Pac-Man was a big hit back in the 80s. One of the things he could do was “teleport” from…
A: A C++ program for the given criteria is as follows, File name: main.cpp” //Declare header files…
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: What is the output of the following code where Student is a subclass of Person class? Person s = new…
A: The answer varies acccording to type of class
write a program to print the names of the student by creating a student class .if no name is passed while creating an object of the student class,then the name should be "unknown" ,otherwise the name should be equal to the string valaue passed while creating the object of the student class.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- 1. In the game of Monopoly, a pair of dice are rolled to move a player's piece around the board. If a double is rolled (the dice show the same number), the player receives another roll of the dice. If a double is rolled a second time, a third roll of the dice is received. If a double is rolled on the third occasion, the player forfeits their turn (and goes to Jail). Write a program which simulates two players having 50 turns each (a turn however many dice rolls a player has in a row before it's the other player's turn) and determines: a) the total number of spaces moved by each player; and b) how many times a player rolls a double which results in movement of a piece. Use the randi function. For fun, incorporate the rule that a player cannot leave Jail (cannot move) unless they either roll a double or three turns have passed without rolling a double.Create a program that will count the number of numeric characters in an input string. The program should be able to ask the user for the input string and should be able to display the number of numeric characters on the screen. For this exercise, you should create your class to handle the different operations. Remember that any input/output operations should be done in the main method while all calculations should be done inside the class. Remember that you need to apply encapsulation in your class. Sample Output: Enter a string: Hello 123 Number of numeric characters: 3Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, design a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends’ or family members’ information. very basic ALGORITHM in PSUEDOCODE NOT PYTHON. Use fictitious information.
- Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the number of b, c, d, f, g, h, and z in the string. Demonstrate the class in a program that asks the user to enter a string and returns the number of b, c, d, f, g, h, and z in the user string.In some circumstances, a class is reliant on itself. That is, one class's object interacts with another class's object. To accomplish this, a method of the class may accept an object of the same class as a parameter.The String class's concat function is an example of this situation. The method is called by one String object and receives another String object as an argument. Here's an illustration:str3 is equal to str1.concat(str2);The method's String object (str1) appends its characters to those of the String supplied as a parameter (str2). As a consequence, a new String object is returned and saved as str3. Create Java code to implement the conditions given.Program - Python Make a class.The most important thing is to write a simple class, create TWO different instances, and then be able to do something. For example, create a pizza instance for Suzie, ask her for the toppings from the choices, and store her pizza order. Then create a second pizza instance for Larry, ask for his toppings and store his pizza order. Then print both of their orders back out. You do not need to make your class very complicated. (Shouldn't be the pizza example but something similar)
- 6. Write a method that reads three strings from the keyboard. Although the strings are in no particular order, display the string that would be second if they were arranged lexicographically. 7. Write a method that reads a one-line sentence as input and then displays the following response: If the sentence ends with a question mark (?) and the input contains an even number of characters, display the word Yes. If the sentence ends with a question mark and the input contains an odd number of characters, display the word No. If the sentence ends with an exclamation point (!), display the word Wow. In all other cases, display the words You always say followed by the input string enclosed in quotes. Your output should all be on one line. Be sure to note that in the last case, your output must include quotation marks around the echoed input string. In all other cases, there are no quotes in the output. Your program does not have to check the input to see that the user has entered a…Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, design a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends’ or family members’ information. very basic Algorithm in pseudocode not python. Use fictitious information.Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, design a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends’ or family members’ information. very basic Algorithm in pseudocode. Use fictitious information.
- A class may occasionally be dependent upon itself. In other words, an object of one class engages in communication with an object of the same class. To do this, a method of the class can take an object of the same class as a parameter.An illustration of this scenario is the concat method of the String class. One String object calls the method, while another String object is supplied as an argument. Here's an illustration:str2 = str1.concat;The String object (str1) that executes the method adds its characters to the String (str2) that was supplied as a parameter. As a result, a fresh String object is produced and saved as str3. Write Java code to put the circumstances given into effect.A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design a class,pointType, that can store and process a point in the x-y plane. You should then perform operations on the point, such as setting the coordinates of the point, printing the coordinates of the point, returning the xcoordinate, and returning the y-coordinate. Also, write a program to test various operations on the point. NOTE: USE C++ language solve as soon as possibleThe Hal9000 has one constructor which takes a String parameter of a name of the crew member it is interacting with. It has methods: public String getName() which gets the name public void setName(String newName) which sets a new name public String greet() which returns a string consisting of "Greetings, name" where name is the name supplied in the constructor. public String reportStatus() which returns a string consisting of "All systems are operating normally, name" where name is the name supplied in the constructor. public String execute(String command) which returns a string consisting of "I am sorry, name. I can't " + command where name is the name supplied in the constructor and command is the parameter.