python
1- Write a Shopping Cart class to implement a shopping cart that you often find on websites where you could purchase some goods. Think about what things could you store in a cart and also what operations you could perform on the cart. To simplify matters, you could consider the website to be an electronics e-store that has goods like flat-panel TVs, boomboxes, iPods, camcorders and so on.
2- Design a class for an airline ticket. Some of the field of an airline ticket are start, destination, date of travel, class, price of ticket, number of people traveling, and name of the primary person. Think about the methods appropriate for the class. Add one method call reserve, which will take details of passengers, start date, starting point, destination and other related attributes and returns flight details.
3- Create a class named Player with a default name as "player", a default level as 0, and a default class type of "fighter". Feel free to add any other attributes you wish!
Create an instance method in the Player class called attack that takes another player as a parameter. This function should compare the level of the two players, and return whether the player won, lost, or tied.
Finally create a loop that allows the user to input a name and a class type for two players; the level of both players should be determined at random (between 1 and 99). Print out the name and attributes of each player, and have the first player attack the second. Print whether the player won, lost, or tied. Ask if the user wants to try again.
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images
- USING ENCAPSULATION IN JAVA Create Class designed to describe a home. and provide at least 3 classes. The purpose of each classes varies depending how it will describe a home. It may have class designed to describe what are the names of a family members and can tells if it is the father, mother, siblings and/or 2nd child, 3rd child. may have class designed to describe your house, for example the color of a house, how many floors. It may have class designed to describe the activities at home like at what time to eat for lunch, what time to wash dishes. It and anything that helps you to describe a home by designing a class.arrow_forwardUsing Java Language: DESCRIPTION The goal is to create a library called DisneyPlus, which hosts Movies and Books, and then to be able to view information such as the best movie (based on score), the most expensive book, all the movies in which an actor has acted. The classes you need to define are Consumer, User, Category, Asset, Book, Movie, DisneyPlus. Apart from these, you do not need to define any classes. You can use any built-in method or structure that you think will work for you. QUESTION Define a class named Consumer. id:int birthYear:int, salary:int, firstName:string, lastName:string, ------------------------------------------------------------------------------- Define a class named User and inherite it from the Consumer class. loginStatus:boolean; //if user signed in set true. Default value is false userName:string; password:string; User(id,firstName,LastName,userName,password); -------------------------------------------------------------------------------…arrow_forward6 Javaarrow_forward
- Discussion: Advantages of Methods This discussion has 2 parts: What are the advantages of using methods? Name at least 2 advantages and how you benefit from each. List at least 1 scenario you would want to use methods instead of having the code in the main class.arrow_forwardExplain each part of the Pseudocode below: START Public Class BankingSystem Declarations string accname double balance = 0 int pin, userpin, newpin void create() void dispbalance() void withdraw() void pinchange() void deposit()EndClass void BankingSystem::create print “Enter Your Name: ” Cin.ignore Getline(cin, accname) print “Enter Your Pin: “ Input user pin Void BankingSystem::pinchange print “Input old Pin: “ Input userpin If (pin == userpin) print “Enter new pin: “ Input newpin pin = newpin print “Your pin was successfully changed” Else print “Please re-enter old pin” void BankingSystem::dispbalance print “Enter your pin: “ Input userpin If (pin == userpin)…arrow_forwardPlease include java doc commentarrow_forward
- The programming language is Python. Please help me. Thanks in advancearrow_forwardWrite a code in Java programming You are working in a game company that is developing a new RPG game. One of the core features of the game is the ability to create and manage different types of characters, such as warriors, mages, and archers. However, your colleague, who was previously working on the implementation of the CharacterManager class, has been laid off due to excessive absences. You have been assigned to take over the project and complete the implementation of the class based on the design specifications outlined below: Given the following main method: public static void main(String[] args) { CharacterManager manager = CharacterManager.getInstance(); manager.createCharacter(CharacterType.WARRIOR).attack(); manager.createCharacter(CharacterType.MAGE).attack(); manager.createCharacter(CharacterType.ARCHER).attack(); } Your output should be: Warrior is attacking Mage is attacking Archer is attacking Note that you should not change the method signature.arrow_forwardTrue or False A class can implement more than one interface.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