Build the ItemToPurchase class with the following specifications: Attributes item_name (string) item_price (int) item_quantity (int) Default constructor Initializes item's name = "none", item's price = 0, item's quantity = 0 Method print_item_cost() Ex. of print_item_cost() output: Bottled Water 10 @ $1 = $10 In the main section of your code, prompt the user for two items and create two objects Ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 Add the costs of the two items together and output the total cost. Ex: TOTAL COST Chocolate Chips 1 @ S3 = S3 Bottled Water 10 @ $1 = $10 Total: $13
Q: Write an application that prompts for and reads the numerator and denominator of a fraction as integ...
A:
Q: Write a Java Program to take two strings from the user ka and b, print the result of putting them to...
A: Java is a high level,class based, object-oriented programming language that is designed to have as f...
Q: public class AverageWithSentinel public static final int END_OF_INPUT = -500'; %3D public static voi...
A:
Q: Instead of dynamically allocating an array to store the data, your program will will an STL array. E...
A: Explanation: Include the necessary header files. In the main function initialize the array with the...
Q: Please perform test cases according to the intructions provided. Box code is given below. Question i...
A: java is a compiled language that follows the concept of oops to make projects. It is used to build v...
Q: 32K L1
A: given - Suppose a direct-mapped cache uses a 32K L1 memory and a 256K L2 memory. How many of the L2 ...
Q: Discuss the purpose and importance of mathematical writing.
A: Perusing, composing, and arithmetic are, or ought to be, indivisible. Involved math can invigorate i...
Q: Computer science What is AWS S3's support for Replication Rules?
A: The automatic, asynchronous copying of objects between buckets in the same or separate AWS Regions i...
Q: 2-write V.B program to print ali, Date and time after each 3 sec and continue until stop the timer a...
A: I have answered this question in step 2.
Q: Instruction: A mathematician named Ulam proposed generating a sequence of numbers from any positive ...
A: PROGRAM EXPLANATION Import the java.util package. Create the main class. Define the main method. As...
Q: How does the database method, as opposed to the file system approach, result in less maintenance?
A: Introduction: The following factors contribute to the lower maintenance requirements of the database...
Q: List appropriate Worst Case Big O Notation under the different algorithms or data structure operatio...
A: To compare algorithms on the basis of running time complexity Big O notation is used.
Q: The population of the five most populous Australian cities at the last three census is recorded in t...
A: Since no programming language is mentioned, I am using Matlab. Code: cities=categorical({'Sydney...
Q: Compare and contrast cache memory and magnetic disk storage in a computer system with respect to the...
A: Please find the detailed answer in the following steps. Note: As per the Bartleby guideline I can...
Q: Consider a table called Employee with schema (empID, salary, rank, deptID) and a table called Projec...
A: We have to fetch the employee id's who are working in HR department Then we will check if manager of...
Q: a) consider the employee database . What are the appropriate primary keys? b) Consider the employee...
A: a) The appropriate primary key is written in bold and underlined: employee(person_name, street, city...
Q: Write an application that reads a value representing a number of seconds, then displays the equivale...
A: JAVA Program: import java.util.*;public class SecondsToTime{ public static void main(String[] arg...
Q: Consider how collaboration may be impacted if the cloud computing trend had any effect on the way pe...
A: Cloud collaboration is a type of enterprise collaboration that allows employees to work together on ...
Q: What is the definition of an object program?
A: Object program is the program that is executed by machine.
Q: Dynamic programming can only be used to solve optimization problems. True False
A: Dynamic programming is mostly used to tackle optimization challenges. When we talk about optimizatio...
Q: Used Python programming. Let's think of some creative ideas and implement them in this project. Yes!...
A: Now at first you can collect the images of the gates and truthtables as you want . Make sure the ima...
Q: In Bubble Sort Ascending Order Show the step by step process on how sorting was done such as first ...
A: answer is
Q: C++ numbering systems convert from octal to hexadecimal.
A: Given To know about the octal to hexadecimal in C++ .
Q: 1). ....reliable transport between sending and receiving process (TCP, UDP)
A: As per guidelines I can answer only first 3 sub-parts. I hope you will understand. Thank You. 1. TC...
Q: cts might arise when designing an architecture for which both availability and secu
A: Design conflicts might arise when designing an architecture for which both availability and security...
Q: Using Java Eclipse IDE Create gui like this Frame Java Swing or jframe
A: Explanation: I have provided an explanation within the code in the comment. Code run successfully a...
Q: Synaptic weights are w,-1.2, w,- -0.4, w,= 0.7. Find the given input above (or) below the line ?
A: The answer is
Q: In Merge Sort Ascending Order Show the step by step process on how sorting was done such as firs...
A: Merge Sort: It is the sorting technique which follows divide and conquer approach and uses this appr...
Q: Create a class named student with two overloaded methods named String[] info(String []name,int[] ma...
A: Note :- You have not mention the language of the program so i am doing you question in Java. Your Ja...
Q: Assume you're working on a fantastic social networking platform. You expect to have half a million u...
A: EXPLANATION AND ANSWER: 1.Prospecting via a Social Media Platform: Goldmine: The marketing potential...
Q: What precisely is autonomic computing, and how does it contribute to the advancement of cloud comput...
A: Answer in step 2
Q: Write a program that inputs the hourly rate and number of hours worked. Compute and display the gros...
A: Here I have taken input from the user and then stored it into 2 different variables. Next, I have ca...
Q: IN C PROGRAMMING LANGUAGE Input a 5 digit positive integer and print the count of ODD digits in the ...
A: C Program: #include <stdio.h>#include <math.h> // Function to count the odd digitsint co...
Q: use the laws of Boolean algebra to obtain a simpler equivalent expression, and draw the correspondin...
A: Final Output = (x' + y) . x . y = x' . x . y + y . x . y [By distributive property] = x . x' . y + ...
Q: In what ways does the information system differ from other systems in terms of organizational, manag...
A: Introduction: An information system (IS) is a structured, sociotechnical organizational structure us...
Q: d. Write down thể ô 10, 101, 10o 11, 10, and Execute it. Step through the program using the followin...
A: Given code is begin clear sum again: load zero compare n jumpeq done load sum add n store sum in n ...
Q: a. Write a python program that writes data to a file. The data consists of a series of records, each...
A: The Answer is
Q: Q7: Write the treatment plan for the following risk "Possibility of wrong data entery is 6.5%"
A: The answer is given below.
Q: 2) Design DFA for the following Language. Where Σ = {a,b} and give the formal definition of your mac...
A: Approach Used –The first thing we observe is that both 0’s and 1’s should be at least 2. If any of t...
Q: What is header file used for? Answer Choices: a. It is used to work with command line arguments. b....
A: stdarg.h is a header in the C standard library of the C programming language that allows functions t...
Q: Compare and contrast the three most common routing approaches. (Distance-vector routing, Link-state ...
A: Introduction: Routing is the process of determining the best route for traffic inside a network and ...
Q: You have been given the following code which represents some Unicode characters in UTF-8 encoding. E...
A: UTF-8 is called as “Unicode Transformation Format - 8 bits.” In order to store information, computer...
Q: Write the code to copy values in one array to another. In the following code snippet, we copy values...
A: To allocate space, new operator is used followed by type of variable. To de-allocate memory, delete ...
Q: 4. 1011012 = 10= _ 5. What is the gray code of 101011110010102? 16 6. Solve: ABF5H - 9CDFH
A: Ans:) This problem requires conversions from one base of another. The complete solution is given bel...
Q: For the grammar G = (E, NT, R, S) where = {a, b, S}, NT = {a, b} and R = {S→ aSb, SaSa, S→bSa, S→ bS...
A:
Q: Define coupling, cohesion, and refactoring Run zuul-with-enums-v2. How many rooms are there in the s...
A: Coupling: Coupling is the measure of the degree of interdependence between the modules. A good softw...
Q: 11. Write a JAVA program to input two strings x, y and create a new string of the form small + large...
A: Write a JAVA program to input two strings x, y and create a new string of the form small + large + s...
Q: Illustrate TWO (2) situations where security guards are the better choice in making complex decision...
A: Benefits of Guards1. They provide a visible “human” barrier to theft.The first reason why people wan...
Q: 1a.) Explain why an operating system is regarded as a resource manager; and give two examples of Ope...
A: The operating system acts as a manager of the above resources and allocates them to specific program...
Q: Determine the components of the vectors [u1, u2] and [V1, V2] so that a[u1, U2] + [V1, v2] generates...
A: Here, I have to provide a solution to the above question.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Step by step
Solved in 3 steps with 3 images
- In Kotlin, Write a Circle data class, with a radius as a parameter to the constructor, a custom-coded property for the area, and a sizeRatio() function that takes a reference to another Circle and returns the ratio of the radius of the instance circle (the one you call the function on) to the other circle . Use math.pow and math.PI. Write a main() that creates a circle, prints it (which will print it's automatically generated toString()), prints its radius, creates another circle, and shows the size ratio of the two.a. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly. Create a Fraction class with fields that hold a whole number, a numerator, and a denominator. In addition: Create properties for each field. The set access or for the denominator should not allow a 0 value; the value defaults to 1. Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.) Add a Reduce() method that reduces a Fraction if it is in improper form. For example, 2/4 should be reduced to 1/2. Add an operator+() method that adds two Fractions. To add two fractions, first eliminate any whole number part of the value. For example, 2 1/4 becomes 9/4 and 1 3/5 becomes 8/5. Find a common denominator and convert the fractions to it. For example, when adding 9/4 and 8/5, you can convert them to 45/20 and 32/20. Then you can add the numerators, giving 77/20. Finally, call the Reduce() method to reduce the result, restoring any whole number value so the fractional part of the number is less than 1. For example, 77/20 becomes 3 17/20. Include a function that returns a string that contains a Fraction in the usual display format—the whole number, a space, the numerator, a slash (D, and a denominator. When the whole number is 0, just the Fraction part of the value should be displayed (for example, 1/2 instead of 0 1/2). If the numerator is 0, just the whole number should be displayed (for example, 2 instead of 2 0/3). b. Add an operator*() method to the Fraction class created in Exercise 11a so that it correctly multiplies two Fractions. The result should be in proper, reduced format. Demonstrate that the method works correctly in a program named FractionDemo2. c. Write a program named FractionDem03 that includes an array of four Fractions. Prompt the user for values for each. Display every possible combination of addition results and every possible combination of multiplication results for each Fraction pair (that is, each type will have 16 results).in java Create a class for Student and implement all the below listed concepts in your class. Read lecture slides for reference. Class Name: Student 1. Data fields studentID name email majorDepartmentSelect proper datatypes for these variables. 2. Constructors – create at least 2 constructors No parameter With parametersSet id and name using the constructor with parameters. 3. Methods toString method : To print the details of the Student. Setter and getter methods 4. A static variable count : To keep the count of Student objects5. Visibility Modifiers: private for data fields and public for methods 6. Write some test cases in main method
- Java question please Create a class called Account that has the following attributes: Account Client - AccountHolder Double - Balance Date - DateCreated Account() Account(Client AccountHolder, Double Balance) getAccountHolder() - Client setAccountHolder(Client) - void getBalance() - Double deposit(Double) - Double withdrawal(Double) - Double getDateCreated() - Date toString() - String compareTo(Account) - Integer equals(Account) - Double Notes: The account holder attribute will link to the Account class that you created in problem 6. Your constructor and overloaded constructor should set the date created to the current date. Your deposit method should add to the balance Your withdrawal method should remove from the balance, as long as there is enough money to withdrawal1. Create a class called Student, with the following attributes/variables:a. studentName (String)b. studentNumber (int)sc. regYear(long)d. faculty(String)e. department(String)2. Add the following methods in Student:a. accessors and mutators for all variablesb. toString methodi. Formulate your toString so that it only shows studentName,studentNumber and faculty3. Create a class called MyFriends, with the following attributes variables:a. studentArray(Student[])4. Add the following methods in MyFriends:a. fillArrayi. Using scanner ask how many students does the user want to inputii. Capture user input for all of his friends(Of course we are assuming all your friends would be similarUWC students, go ask around and meet new friends, alsopreferably not in the same Computer Science department … ifpossible … only if possible)b. maini. Call the fillArray methodii. Count how many Computer Science studentsiii. If half or more students are Computer Science students, thendisplay “You … need more…Write the definition of a class Player that has the following methods: • An __init__ method that initializes the following attribute variables: o An attribute variable named name , initialized to the empty string. o An attribute variable named score , initialized to the value 0. • A method named set_name that accepts one argument that is assigned to the attribute variable name . • A method named set_score that accepts one argument that is assigned to the attribute variable score . • A method named get_name that accepts no arguments, and returns the value of the attribute variable name . • A method named get_score that accepts no arguments, and returns the value of the attribute variable score .
- IN JAVA LANGUAGE Write an ATM class with an ArrayList of Account objects as an attribute. In the constructor, add 3 Account objects to your ArrayList. They can all have a start balance of $100 and an annual interest rate of 0.12. Include two methods, menu and makeSelection as outlined below. Please note that since both methods get user input, create a Scanner attribute to use in both. menu method This method does not have any parameters and does not return a value. It should: Get the account number from the user. This corresponds to the index of the items in the ArrayList. Since there are 3 elements in your ArrayList, you are going to ask them for a number between 1 and 3, but keep in mind that the indices of the ArrayList are 0-2, so you'll have to adjust the value you get from the user accordingly. Present the user with a main menu as shown below: Get their menu selection Call the makeSelection method, passing it the account index obtained in step 1 and the menu selection…tri1 and tri2 are instances of the Triangle class. Attributes height and base of both tri1 and tri2 are read from input. In the Triangle class, define instance method print_info() with self as the parameter to output the following in one line: 'Height: ' The value of attribute height ', base: ' The value of attribute basePlease write the Java code for a Phone class that represents a mobile phone, as detailed below: It should have instance variables (attributes) for make, model, color (all stored as Strings) and capacity (stored as int: the storage capacity in GB) Please define one constructor with parameters for all those attributes. The Phone class will be immutable, except its storage capacity can be changed. So please write only one mutator method, called .setCapacity. Please write accessor methods for each instance variable. Please write a .toString() method to display all the Phone's information. Please write a .equals method to compare two Phone objects, returning true if all their attributes are the same. Finish the Jave program to show the outputs bellow: Code: class Main { public static void main(String[] args) { Phone craigPhone, bettoPhone, tobyPhone; craigPhone = new Phone("Samsung", "Galaxy S21 5G", "Phantom Violet", 256); bettoPhone = new Phone("Apple", "iPhone 13 Pro",…
- You are required to build a class JewelleryItem. A jewellery Item has a type (string) , price (float),material (string), daysToGo (int).These attributes represent the type i.e ‘ear ring’, necklace, finger ring etc. The material can be gold,silver, plastic etc. The daysToGo attribute represents the number of days it will remain fit for use.1. You are required to provide the following parameterized constructors JewelleryItem(string type, float price, string material, int daysToGo) Jewlleryitem(string type, float price, int daysToGo) // the material will get “gold” as default JewelleryItem(string type, float price) //the material defaults to gold and daysToGo defaults to100.2. Now provide getters for each of the attributes above but setters for only price, daysToGo3. Provide a function/method makeUse(). This function represents the use of this item for one daywhich reduces the daysToGo by 1. This function returns true if the daysToGo is greater than 1 andfalse otherwise. This means…This is the question I am struggling on - Create a TeeShirt class for Toby’s Tee Shirt Company. Fields include: orderNumber - of type int size - of type String color - of type String price - of type double Create set methods for the order number, size, and color and get methods for all four fields. The price is determined by the size: $22.99 for XXL or XXXL, and $19.99 for all other sizes. Create a subclass named CustomTee that descends from TeeShirt and includes a field named slogan (of type String) to hold the slogan requested for the shirt, and include get and set methods for this field. This is the code I have done but I am not getting the right output- public class CustomTee extends TeeShirt { private String slogan; public void setSlogan(String slgn) { // write your code here slogan = slgn; } public String getSlogan() { // write your code here return slogan; } } ----------------------------------------- import java.util.*;…Create a class called GraduateStudent that has the following attributes: GraduateStudent String - FirstName String - LastName String - Major String - Minor Integer - UIN Double - GPA GraduateStudent() GraduateStudent(FirstName, LastName, Major, Minor, UIN, GPA) calculateFinalGrade(Double, Double, Double) - Double getFirstName() - String setFirstName(String) - void getLastName() - String setLastName(String) - void getMajor() - String setMajor(String) - void getMinor() - String setMinor(String) - void getUIN() - Integer setUIN(Integer) - void getGPA() - Double setGPA(Double) - void toString() - String compareTo(GraduateStudent) - Integer equals(GraduateStudent) - Boolean Note: The calculate final grade takes 3 doubles, each of which will be an exam grade out of 100. The first two exams are worth 25% of the final grade, and the third exam is worth 50% of the final grade. You should return this final grade as a double.