OBJECT ORIENTED PROGRAMMING LESSON LABORATORY EXERCISE-5 Problem: We have a ship object, we have to load the ship according to the capacity. The user enters the amount of the load from keyboard and the program loads the amount on the ship and informs the user. If the total amount of the load exceeds the capacity then program warns the user. For example: Let's say, capacity of the ship is 3000 tonnes. Enter the amount of the load (tonnes): 1000 New amount of the load is 1000, you can load 2000 tonnes more. Enter the amount of the load (tonnes):3000 New amount of the load is 1000, you can not exceed the capacity. Write Ship class and create a ship object in your program to solve the problem.
Q: Algorithm for Sylow Using Orbits and Blocks function sylow( G:group; p:prime ):group; Algorithm for…
A: function sylow( G:group; p:prime ):group;(* Return a Sylow p-subgroup of the permutation group G *)
Q: Explain TITLE & TYPE
A: The process of creating a set of instructions that tells a computer how to perform a task is known…
Q: 2. There are 6 different datasets noted as A,B,C,D,E,F. Each dataset is clustered using two…
A: In this question we will identify cluster
Q: Use python code with "def mirror(img):" but without cv2, numpy or PIL mirror(img) - Flips the image…
A: Here our task is to write a python program to convert the given image into its mirror image (left…
Q: Disadvantages of Open Collector Output:
A:
Q: python code keeps failing. can someone help me locate the issue?
A: INTRODUCTION: A syntax error is thrown by the Python interpreter or parser if the proper syntax of…
Q: How can the effectiveness of participants' interpersonal skills be measured throughout the…
A: INTRODUCTION: It is the kind of ability we use to communicate in daily life, such as speaking,…
Q: Define / describe class, attributes and methods and how they work with eachother. What is the…
A: Class:- A class instance is what we refer to when we make an object of that data type. Like a…
Q: Discuss Turning Machine as computer of functions.
A:
Q: What is EVA?
A:
Q: While creating a policy on information security for a medium-sized business, at least three other…
A: Having comprehensive measures in place shows your employees that you're doing your due diligence to…
Q: NOTE: This is a multi-part question. Once an answer is submitted, you will be unable to return to…
A: 10n ∣ n ≥ 0} (Check all that apply.) Check All That Apply A) S → 1A, A → 0A, and A → λ B) S →…
Q: public static void selectionSort (int[] ar) while (i ar[j]) { i++; } ++j; = int temp = ar[i]; ar[i]…
A: Selection sort is a sorting algorithm that sorts the elements in ascending or descending based on…
Q: Question 11 par reserve space in memory for one number of type float and then store the memory…
A: The question has been answered in step2
Q: Look at how well the various security precautions work to counteract the various threats.
A: Introduction: According to the information, we must establish security methods to address different…
Q: I need following code in java Sorting with Lists In this exercise, we want to realize list versions…
A: Answer: We have done code in the C++ Programming language and we have also attached the code and…
Q: You are given an array arr[] of size n. Find the total count of sub-arrays having their sum equal to…
A: Here we have given code of the required task. You can find the solution in step 2.
Q: Use technology and data to learn more about the difficulties encountered by information systems.
A: Use Technology: Every day, technology advances that assist you in various ways. You must,…
Q: Design a turing machine that erases all non- blank symbols on the tape, where the sequence of…
A:
Q: 2. What are the two primary lines of security defense and how can organizational employees use the…
A: Let's see the answer:
Q: 4. How to run multiple processes inside a container? A: Due to immutable architecture, containers…
A: “Since you have posted multiple questions, we will provide the solution only to the first question…
Q: Identify the productions of the phrase-structure grammar for each of these languages, where S is the…
A: Answer the above question are as follows
Q: Gfgfhffhhffyfy
A: The architecture used in a software system refers to the particular formats along with the patterns…
Q: Some of the issues that arise for users when interacting with a system that is lacking in continuity…
A: Answers Major computer problems include losses and breakdowns, which result in both unnecessary high…
Q: Design a Turing machine to accept the language given by a regular expression 0(0+1)*11
A: The regular expression given:- 0(0 + 1) * 11 Here . means and + means or * as much as wanted.
Q: Explain the use of any two String Handling functions with syntax and example
A: Definition: To work with string values, the C programming language offers a set of pre-defined…
Q: Multiple difficulties may arise from the widespread use of IT in the workplace. How should we…
A: (1) Lacking NETWORK SECURITY One of the most important aspects of keeping your company safe is…
Q: Ms are commonly used as embedded on-chip memories. T/F
A: Dear Student, The answer to your question with required explanation is given below -
Q: Plot the x_values and y_values using Matplotlib plt.plot() function. You should see a normal…
A: Algorithm of the code:- 1. Start 2. We first import the necessary libraries. 3. We then define a…
Q: Please please do this manually a.What is the distance between the two farthest members? (max or…
A: The question has been answered in step2
Q: an test-driven developme
A: Detailed answer to your question is given below -
Q: Design a TM to find the value of log(n), where nis any binary number.
A:
Q: A common problem in textual analysis is to determine the frequency and location of words in a…
A: Read the text files using: # Read the doc files with open('doc1.txt') as f: text1 = f.readlines()…
Q: Write a program that reads the contents of a text file and prints the letter that starts the most…
A: Algorithms: START Take input file # list of outputs desired # to read each line of the file…
Q: Disadvantages of Open Collector Output:
A: The use of an open-collector output is to connect single side of the device being managed to ground.…
Q: rite a function called match_words() that takes three input parameters; a list of strings of any…
A: The python program is given below:
Q: Make a procedure how to manufacture computer mouse
A: To make the computers mouse, several manufacturing processes are performed simultaneously to make…
Q: Why is a single system compromise insufficient for a penetration test? Justify your position
A: Answer:
Q: se python code with "def drawItem(img,item,row,col):" but without using cv2,PIL or numpy…
A: image is an np array you can do any operation numpy provides
Q: Explain Meaning of various states.
A: :: solution:: a condition or way of being that exists at a particular time: The building was in a…
Q: (Variable-Length Argument List) Write an application that calculates the product of a series of…
A: We need to write a program for the given scenario. Programming language used is Java. ***As per…
Q: Provide details about your own experience getting certified and trained, if you have any.
A: Introduction: An object, person, or organisation may be certified if it has specified traits that…
Q: Here is my input and output. Your TA may choose different dish names and enter tables in a different…
A: The modified Python code is given below with output screenshot
Q: Provide details about your own experience in obtaining credentials and training.
A: Definition: An item, person, or organization may be certified if it possesses specific qualities…
Q: What is the use of CMM?
A:
Q: Failed to compile TestMoney.java:24: warning: [cast] redundant cast to int list[i] = new Money (…
A: The Java compiler verifies the accuracy of each method call during semantic analysis. The error "The…
Q: give two examples of time keeping devices.
A: Introduction We take our capacity to know the precise time for granted in modern times; it's on our…
Q: numpy or PIL minify(img) - Shrinks the image img by half in both height and width and returns the…
A:
Q: Let G = (V, T, S, P) be the phrase-structure grammar with V = {0, 1, A, S}, T = {0, 1} and a set of…
A: Given: G = V, T, S, PV = 0, 1, A, ST = 0, 1 Set of production P: S → 1SS → 00AA →…
Q: 6) In a 64 bit machine with a 8 KB page size for virtual memory, how many entries are there in a…
A: The question has been answered in step2
Write the program with java
Step by step
Solved in 2 steps
- Exercises: PolymorphismProblem 1. VehiclesWrite a program that models 2 vehicles (Car and Truck) and will be able to simulate driving and refueling them inthe summer. Car and truck both have fuel quantity, fuel consumption in liters per km and can be driven givendistance and refueled with given liters. But in the summer both vehicles use air conditioner and their fuelconsumption per km is increased by 0.9 liters for the car and with 1.6 liters for the truck. Also the truck has a tinyhole in his tank and when it gets refueled it gets only 95% of given fuel. The car has no problems when refueling andadds all given fuel to its tank. If vehicle cannot travel given distance its fuel does not change.Input On the first line - information about the car in format {Car {fuel quantity} {liters per km}} On the second line – info about the truck in format {Truck {fuel quantity} {liters per km}} On third line - number of commands N that will be given on the next N lines On the next N lines –…In C# language using Microsoft Visual Studio in Windows Forms App (.NET Framework) A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. Create an application that simulates a slot machine. The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols.Language is c++ Assignment 6 C: Minesweeper - Simplified. For many years, computers sold with the Windows operating system would contain a game called M inesweeper. The player would be presented with a grid, where they would have to click an empty part of the map. If they clicked on a hidden mine, the game would be instantly over. However, if they clicked a safe spot, a hint about nearby mines would be displayed and the player would click another spot. The goal would be to flag all the hidden mines without hitting one. (As an aside, many people did not know these rules and just clicked around randomly until they hit a mine)We will be developing a simplified version of this game. You will prompt the user for a grid size and then created a 2D array with equal width and height (C++ students: Check the Appendix for more information on how to do this). You will initialize the 2D char array with each element equallying a ‘?’ symbol. You will then randomly generate one “mine” value per…
- Java - Programming Develop a letter-guessing game in this assignment.Requirements:1). When the game begins, generate a random letter between A and Z;2). Display a message "I have a secret letter (A to Z), can you guess what it is?";3). Read the user's answer;4). Compare the user's answer and the random secret letter generated;5). If the user answer is before the random secret letter in the alphabet, display "Incorrect. Trysomething later in the alphabet" and go to Step 2;6). If the user answer is after the random secret letter in the alphabet, display "Incorrect. Trysomething earlier in the alphabet." and go to Step 2;7). If the user answer is the same as the random secret letter, display "Well done. Want to playagain (y/n)?";8). Read the user's answer. If the answer is 'y', go to Step 1. If the answer is 'n', go to Step 9;9). Display "Thanks for playing the game. Goodbye!". The program stops.Run your program several times. Take screenshots. Submit your Java file with the screenshotsTic-Tac-Toe For this question, you will be implementing a simple Tic-Tac-Toe game without the graphics. Here is how it works: • First, it is randomly determined if the user starts the game or the computer and this information is shown to the user. The player who starts always starts as "X". • The players (computer and the user) will then take turns in playing. The computer will choose a random empty spot on its turn. The user enters its choice in the console. • Each of the empty spots have a corresponding number that the players choose on their turn. If the user enters anything other than the number of an empty spot (not yet filled with "X" or "O"), it will not be accepted, and they will be prompted to enter a correct number. 2 4 7 8 • After each turn, two things need to be done: 1) displaying the updated board 2) checking if anyone has won (it should be printed who has won – the user or the computer). The game goes on until someone wins or until all the 9 empty spots are filled and no…PROGRAMMING LANGUAGE: C++ ALSO PUT SCREENSHOTS WITH EVERY TASK. TASK 1 : A class of ten students took a quiz .The grades (integers are in range 0-100) for this quiz are available to you .Determine class average on quiz . TASK 2: Write c++ code that print summery of exam result and decide either student should have makeup class or not .If more then 30% of class fails in exam it’s mean they need a makeup class otherwise they don’t need any makeup class. For class strength take input from user (Hint: take two variables pass and fail) TASK 3: write a c++ that will determine whether a department-store customer has exceeded the credit limit on the charge account .For each customer , following facts are available : Account number (an integer) Balance at beginning of month Total of all items charged by this customer this month Total of all credit applied to this customer’s account this month. Allowed credit limit You are required to use a while structure to input each of these facts ,…
- Problem: Bugs are simple creatures that only know how to walk towards other bugs. Bugs maintain information about their (x, y) position; by which it can tell if they are standing next to other bugs. Watch the following video: bug movement. Create a java project that simulate bugs movement. You need to write a class “Bug" that models a bug moving along a straight line and it can turn to change its direction counterclockwise (i.e. 90 degree to the left; north → west → south → east → north). In each move, its position changes by one unit in the current direction. Details of the "Bug" class is described below. Your simulator should read information of an unknown number of “Bug" objects from an input file called “Bugs.txt". Each line represents a bug and the initial position and facing direction of this particular bug. Keeping the first bug position as a reference the simulator should move the second bug next to the first bug forming a cluster and its final position and direction should be…Monty Hall Problem – Coding Lab In this lab, you will write a code that simulates the Monty Hall Game Show. Thegame host gives the participant the choice of selecting one of three doors. Twodoors has a goat behind them and one door has a prize. The set of choices arerandomized each round. The participant needs to select the door with the prizebehind it. When the participant selects a door, the game host reveals a door with agoat behind it. The game host opens a door (different from the one selected by theparticipant) that has a goat behind it. The participant is then given the option tochange their choice. When you run your code, the code would display a message prompting the user toinput their door choice, labelled as 1, 2, and 3. Then the code will display a doornumber (different from the one the user picked) with a goat behind it and ask theuser if they would like to change their choice. The code then displays a message onwhether the user guessed the correct door. The game then…Using JAVASCRIPT write an object prototype for a Person that has a name and age, has a printInfo method, and also has a method that increments the persons age by 1 each time the method is called. Create two people using the 'new' keyword, and print both of their infos and increment one persons age by 3 years. Use an arrow function for both methods */ // Create our Person Prototype // Use an arrow to create the printInfo method // Create another arrow function for the addAge method that takes a single parameter // Adding to the age
- python3: Class vs Instance variable Make a class names Foo Add a class variable to foo called x and initialize it to 5 Add an instance variable to foo called y and initialize it to 100 Make an instance of the class, call it f Using Foo., print out the value of x (proper etiquette for class variables) Using f., Print out the value of y (proper etiquette for instance/self. variables) Hint: remember that class variables are the ones where their value is the same for all instances/clones. And instance variable (which you declare inside the __init__ method with the self. preface, are unique to each clone. When you print a class variable the proper way is to use classname . (for example Foo.x) and when you print an instance variable you use the instance handle (for example f.y.)Turtle Hare Race Use two Timer objects to write a Java program to simulate the race between turtle and hare. The hare runs faster than the turtle, but it may sleep once or twice during each race. You should take the following requirements into account: The user is allowed to define whether the hare will not sleep, will sleep once, or will sleep twice during the race, by clicking point(s) along the lane. If the user clicks more than twice, only the first two should be considered. The user is allowed to define the speed of the turtle and of the hare. The two numbers input from the user indicate the numbers of milliseconds for each step of the tortoise and for each step of the hare. The user is also allowed to define the sleep time of the hare in milliseconds. If the hare sleeps twice during a race, it sleeps the same amount of time. For each race, the program should provide the result who has won. In Java PleaseTranscribed Image Text JAVA Programming Problem: In the game of "Assassin's Creed", you control a ship with a cannon which is attacking a large enemy Assassin's Creed, armed with many guns. Your goal is to destroy as many of the guns as possible. The battle field is a 2D Cartesian grid, where your cannon is located at the origin. The enemy Assassin's Creed is a horizontal line segment located from the coordinates (X1, Y) to (X2, Y). There are exactly (X2 - X1 + 1) guns on the ship, located at the integer points (X1, Y), (X1+1, Y), ..., (X2, Y). However, the problem is, you cannot always fire at a gun. There are supernatural rocks located at all points of the battlefield whose X and Y coordinates are both integers. In order to fire successfully at an enemy's gun, the line connecting your cannon and that gun must not go through any rocks. Develop a JAVA code to output the number of the enemy battleship's guns that your cannon can destroy. Test Case Result 1 2 2 -2