Provide two methods, one of renting a vehicle and the other for returning a vehicle with the following method specifications.
The rent() methods accepts as argument the name and license number of the person renting the vehicle and also the number of days the vehicle will be on hire. If the vehicle is currently available it should set the status to '0', store the name, license number and days rented in the corresponding instance variables before returning true. Otherwise this method should simply return false. This method should have the following signature: public bool rent (string name, string license, int rented)
The returnBack() method should return 0(zero) if an attempt is made to return back a car which is not on loan, otherwise it should compute and return the charges for renting the vehicle (number of days multiplied by daily-rate). This method should have the following signature: public double returnBack ()
Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array/list.
The next lines contain the integers.
The last line contains an integer to be searched.
5
3
21
2
5
23
28Output
A line containing a string.
WrongLOOPING STATEMENTS AND FUNCTIONS
Create a flowchart to guide you in the process
Create a function that will accept the value of i and return the value of n
Possible values of i is any positive value from 2 to 10
n is computed based on the value of i; see the following table for the sample Input / Output
!!Please see these 3 examples on how the screen will work when the program runs!!
1.)
i : 3
Process: 1*2*3
n: 6
2.)
i: 5
Process: 1*2*3*4*5
n: 120
3.)
i: 7
Process: 1*2*3*4*5*6*7
n: 5040
Screen/Layout
(Home Screen)
Input i:3
Process: 1*2*3
Output: 6
Try Another [Y/N]: Y
Input i: 5
Process: 1*2*3*4*5
Output: 120
Try Another [Y/N]: Y
To be able to do this, you should create a class for a point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. Implement the following methods for the Rectangle:
Input
A pair of numbers representing the points for the rectangle (x and y).
5 8Output
The first few lines contain the drawn rectangle. After one empty line, the next line prints either "RECTANGLE" or "SQUARE".
#·#·#·#·#·#
#·········#
#·········#
#·········#
#·········#
#·········#
#·········#
#·········#
#·#·#·#·#·#
RECTANGLE
AREA:·40
PERIMETER:·26
CENTER·POINT:·(2.50,4.00)A line containing a string seperated by a comma.
Python, is, fun
by CodeChum Admin
Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array/list.
The next lines contain the integers.
The last line contains an integer to be searched.
5
3
21
2
5
23
2Output
A line containing a string.
PresentToday, we shall compute for the squares of all the numbers.
There's already a predefined array/list containing 100 integer values. Loop through each values, compute their squares, and display them.
public class Main {
public static void main(String[] args) {
int[] array = {
2, 3, 5, 100, 7, 3, 5, 3, 1, 4,
76, 77, 78, 79, 80, 54, 68, 61, 34, 33,
44, 49, 100, 5, 2, 87, 34, 33, 2, 1,
4, 5, 8, 2, 1, 8, 5, 3, 2, 1,
88, 22, 23, 33, 48, 44, 46, 48, 50, 52,
45, 47, 49, 51, 53, 1, 1, 1, 1, 1,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
20, 19, 18, 17, 16, 15, 14, 13, 12, 11,
11, 22, 33, 44, 55, 66, 77, 88, 99, 100,
1000, 2001, 3000, 4001, 5000, 6001, 7000, 8001, 9000, 10001
};
for (int i = 0; )
}
}
Output
Multiple lines containing an integer.
4
9
25
10000
49
9
25
9
1
16
.
.
.by CodeChum Admin
Remember that time when we've tried identifying the largest digit among the given integer? Well, let's take it to the next level, and figure out the same thing on arrays/lists!
Let's do this one more time!
Instructions:
Input
The first line contains the size of the array/list.
The next lines contains an integer on each.
5
5
34
3
23
10Output
A line containing an integer.
34I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.
How about that?
Create a python code of this output
Choices:
a. Calculator
b. Odd or Even
c. Positive or Negative Number
Enter your choice: c
Enter a number: -6
-6 is a negative number.