This is java. I need help with my computer science class.
Complete the ParkingGarage class shown below. The ParkingGarage class keeps track of how many cars are present, the maximum number of cars it can hold and the parking fee. The number of cars present in the garage at any given time cannot exceed the maximum and can never be negative.
public class ParkingGarage
{
// declare instance variables
// postcondition: all instance
variables are initialized
public ParkingGarage(int numCars,
int maxCapacity, double fee)
{
}
// postcondition: the number of
occupied parking spaces and daily admittance are
// increased by the given number and
the occupied spaces cannot exceed the maximum
public void addCars(int num)
{
}
// postcondition: the number of
occupied parking spaces is reduced by the
// given number and cannot be
negative
public void deleteCars(int
num)
{
}
// postcondition: an amount equal to
the total number of cars entering the
// parking garage for the day
multiplied by the daily fee
public double calcSales()
{
}
// other methods not shown
}
Code
public class ParkingGarage
{
// declare instance variables
private int numCars,maxCapacity;
double fee;
// postcondition: all instance variables are initialized
public ParkingGarage(int numCars, int maxCapacity, double
fee)
{
this.fee=fee;
this.maxCapacity=maxCapacity;
this.numCars=numCars;
}
// postcondition: the number of occupied parking spaces and
daily admittance are
// increased by the given number and the occupied spaces cannot
exceed the maximum
public void addCars(int num)
{
if((numCars+num)<=maxCapacity)
numCars+=num;
}
// postcondition: the number of occupied parking spaces is
reduced by the
// given number and cannot be negative
public void deleteCars(int num)
{
if((numCars-num)>=0)
numCars-=num;
}
// postcondition: an amount equal to the total number of cars
entering the
// parking garage for the day multiplied by the daily fee
public double calcSales()
{
return fee*numCars;
}
// other methods not shown
}
If you have any query regarding the code please ask me in the
comment i am here for help you. Please do not direct thumbs down
just ask if you have any query. And if you like my work then please
appreciates with up vote. Thank You.
This is java. I need help with my computer science class. Complete the ParkingGarage class shown...
Write the definitions of the member functions of the class integerManipulation not given in Example 10-11. Also, add the following operations to this class: Split the number into blocks of n-digit numbers starting from right to left and find the sum of these n-digit numbers. (Note that the last block may not have ndigits. If needed add additional instance variables.) Determine the number of zeroes. Determine the number of even digits. Determine the number of odd digits Also, write a...
I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java Programming Project #4 – Classes and Objects (20 Points) You will create 3 new classes for this project, two will be chosen from the list below and one will be an entirely new class you invent.Here is the list: Shirt Shoe Wine Book Song Bicycle VideoGame Plant Car FootBall Boat Computer WebSite Movie Beer Pants TVShow MotorCycle Design First Create three (3) UML diagrams...
use java follow my code: public class q1 { // Instance Variables int currentFloor; double maximumWeight; int topFloor; // Constructor Declaration of Class public q1 (int currentFloor, double maximumWeight, int topFloor) { this.currentFloor = currentFloor; this.maximumWeight = maximumWeight; this.topFloor = topFloor; } // Property to get value of currentFloor instance variable public int getCurrentFloor() { return currentFloor; } // Property...
Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include a constructor, the accessors, mutators and methods ‘toString’, ‘equals’, and ‘finalize’. Write a client class to test the behavior of the class and its methods. The outline of the class is given as follows: public class Course...
I need code in java
The Student class:
CODE IN JAVA:
Student.java file:
public class Student {
private String name;
private double gpa;
private int idNumber;
public Student() {
this.name = "";
this.gpa = 0;
this.idNumber = 0;
}
public Student(String name, double gpa, int
idNumber) {
this.name = name;
this.gpa = gpa;
this.idNumber = idNumber;
}
public Student(Student s)...
I need help with this one method in java. Here are the guidelines. Only public Employee[] findAllBySubstring(String find). EmployeeManager EmployeeManager - employees : Employee[] - employeeMax : final int = 10 -currentEmployees : int <<constructor>> EmployeeManager + addEmployee( type : int, fn : String, ln : String, m : char, g : char, en : int, ft : boolean, amount : double) + removeEmployee( index : int) + listAll() + listHourly() + listSalary() + listCommision() + resetWeek() + calculatePayout() :...
Add another public method called add to your Fraction class. This method adds another fraction to the ‘calling object’. Thus, the method will take a Fraction class object as a parameter, add this parameter fraction to the calling object (fraction), and return a Fraction object as a result. HINT: We can use cross multiplication to determine the numerator of the resultant Fraction. The denominator of the resultant Fraction is simply the multiplication of the denominators of the two other Fractions.Add...
Hi everyone! I need help on my Java assignment. I need to create a method that is called sumIt that will sum two values and will return the value.It should also invoke cubeIt from the sum of the two values. I need to change the currecnt program that I have to make it input two values from the console. The method has to be called sumIt and will return to the sum that will produce the cube of the sum...
need help..... sudoku.h class sudoku { public: sudoku(); //default constructor //Postcondition: grid is initialized to 0 sudoku(int g[][9]); //constructor //Postcondition: grid = g void initializeSudokuGrid(); //Function to prompt the user to specify the numbers of the //partially filled grid. //Postcondition: grid is initialized to the numbers // specified by the user. void initializeSudokuGrid(int g[][9]); //Function to initialize grid to g //Postcondition: grid = g; void printSudokuGrid(); //Function to print the sudoku grid. bool solveSudoku(); //Funtion to solve the sudoku problem....
Hi I really need help with the methods for this lab for a computer science class. Thanks Main (WordTester - the application) is complete and only requires uncommenting to test the Word and Words classes as they are completed. The needed imports, class headings, method headings, and block comments are provided for the remaining classes. Javadocs are also provided for the Word and Words classes. Word The Word class represents a single word. It is immutable. You have been provided...