Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
A java
methods that calculate the rectangle’s perimeter and area. It has set and get methods for both
length and width . The set methods should verify that length and width are each floating-point
numbers larger than 10.0 and less than 40.0. Write a program to test class Rectangle .
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- We have a main class that implements a parking charge class of a parking management system. We wanted to generate a junit test class for our main class. Generate a junit test class for our main class ParkingCharge class class Instant{public int hours;public int minutes;} public class ParkingCharge{public String permitID;public String lotID;public double amount;public Instant incurredTime = new Instant(); // toString class definition@Overridepublic String toString(){String permitDetails = "\nPermit ID: "+permitID;String lotDetails = "\nLot ID: "+lotID;String incurredDetails="\nDuration: "+incurredTime.hours+" HH "+incurredTime.minutes+" MM"; // lets say 1 minutes of parking charge is 1 dollaramount = incurredTime.hours*60 + incurredTime.minutes; String amountDetails = "\nParking Charge: "+amount; return permitDetails+lotDetails+incurredDetails+amountDetails;}} Main Class import java.util.Scanner;public class main {public static void main(String [] args){Scanner sc = new…arrow_forwardPlease look at the images for the programming question. I am not sure sure where I should start on this. All coding is done in Java, using IntelliJ Idea.arrow_forwardIn java i have a class calle rational the input i receive is in yellow and the output is supposed to look like what comes after the yelloarrow_forward
- Write a public int method named initialNumberOfSticks which takes two int parameters named max_sticks and min_sticks and returns a random integer value between max_sticks and min_sticks (inclusive). You will create a new instance of the Random class and call it r. Use the nextInt method of r to a get random value within a desired range and use it to compute the value that will be returned. Your method must be a syntactically correct Java method.arrow_forwardDefine a new “User” class that contains a username (string), a password(string) and user id number (integer). For example, a User can haveo “john”, “secret”, and 12345It should have at least the following methods:o toString method must return all the user information as a string inthe following format:NAME(user-name) PASSWORD(password) ID(user-id) such asNAME(john) PASSWORD(secret) ID(12345)o hasValidPassword method that checks and return true if thepassword is not the same as username or contains the user id.o isDuplicate that compares two User objects and return true if theyboth have the same user name and password and false otherwise.Important notes:o You can add as many other methods as you need. But this classshould not provide the default constructor.Show how this class being used to create User objects and how thesemethods are being called and return proper values All data members must be declared as “private”• No global variable can be declared and used• Methods within the…arrow_forwardWrite a Python class, Vehicle, that has three instance variables of type str, int, and float. These respectively represent the name of the vehicle, its year, and its price. Your class must include • a constructor method that initializes each variable to an appropriate value • methods for setting the value of each type, and retrieving the value of each type. method for printing the entire instance of a vehicle. Now define an instance of your class and test all the 4 types of methods including the constructor. .arrow_forward
- in java 2.4. ProblemCreate a class called Exam that a teacher might use to represent an exam for a coursetaught in the university.An Exam should include different information as instance variables – an exam date(day, month, and year), an exam time (hour and minutes), and an exam max marks. Itshould also include 2 constants which are the exam type and exam order.The exam type value may be one of the constant static fields ("Lab Exam", "MidtermExam", "Final Exam") or any other value. The exam order (1, 2, 3, etc.) is set for labexams and midterms by using separate static counters, for other exam types is set to 0.arrow_forwardplease write code in java Create a right triangle class with instance variables(double) for sideA, sideB and the hypo. write three constructors -the 2-param version assigns to sides A and B respectively. the 1-param version assigns the same value to both sides. the 0-param version assigns 10.0 to each side. the constructor also computes the hypotenuse based on the other two sides and saves that in the hypotenuse variable. Create accessors for all three variables. Write a toString() that will print/label the three sides. write some main code to create three instances of your class, one to test each of your constructors. you can input values or use fixed values. Display each instance using an implicit toString() call.arrow_forwardDefine a new “Degree” class that contains a year (integer), a subject (string) and a person’s name (string). For example, a degree can haveo John Smith, 2020, Computer Science It should have at least the following methods: o toString method must return all the degree information: year,subject and person’s name in the following format:NAME(John Smith) SUBJECT(Computer Science) YEAR(2020)o hasTheSameDegree method that compares 2 degrees and returntrue if both have the same year and the same subject. Otherwise, itreturns false. Important notes:You can add as many other methods as you need. But this class should not provide the default constructor. Show how this class being used to create Degree objects and how these methods are being called and return proper values. All data members must be declared as “private” No global variable is allowed to be declared and used Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and…arrow_forward
- Write a java class method named capitalizeWords that takes one parameter of type String. The method should print its parameter, but with the first letter of each word capitalized. For example, the call capitalizeWords ("abstract window toolkit"); will produce the following output: Abstract Window Toolkitarrow_forwardin java Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:wins / (wins + losses). Note: Use casting to prevent integer division. For class method printStanding(), output the win percentage of the team with two digits after the decimal point and whether the team has a winning or losing average. A team has a winning average if the win percentage is 0.5 or greater. Ex: If the input is: Ravens 13 3 where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is: Win percentage: 0.81 Congratulations, Team Ravens has a winning average! Ex: If the input is: Angels 80 82 the output is: Win percentage: 0.49 Team Angels has a losing average.arrow_forwardI have a Programming Question, The following is a class definition for a simple Ebook. So i need to write a second constructor that takes a String array of pages as input and sets the String array instance variable equal to the input. Continue to default the current page number to zero. Part 2: Write a getter and a setter method for the page number variable. The setter should check to make sure that the input is a valid page number and only update the variable if the new value is valid. Part 3: Write a getCurrentPage method that returns the String of the current page indexed by current_page. Here below are the two instance variables and one parameterless constructor that were provided public class Ebook{ private String[] pages; private int current_page; //constructor public Ebook() { this.pages = {"See Spot.", "See Spot run.", "Run, Spot, run."}; this.current_page = 0; }}arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education