We want to create a class of Product that contains multiple private data members such as
quantity: An integer that holds a count value.
objCount: A static integer that holds that count of objects.
serialNo: An integer that holds the serial number of objects of a specific product (assume
the single object of Product class).
Define a constructor that can accept two arguments i.e., totalQuantityOfProduct and
serialNumberOfProduct; and assign it to the respective data members of the class.
Moreover, the static member be shall be initialized from the outside of the class with zero
by using scope resolution operator.
Define operator = that add the value of quantity to the left hand operand. i.e. c2=c1 (the
quantity of object c2 shall be incremented with the quantity of c1).
Define unary operator - that inverts the value of quantity for product class and should
allow the statements like c1 -= 4;
Execute the provided testCases.
class named Matrix that shall contains private data member
matrix: integer type array of size 3 by 3;
constructor that should have default parameters that can set all elements to 0. Moreover, define a function called setMatrixValues(int matrixArray[3][3]) that can assign values of matrixArray (provided to the function in argument) to the matrix array (data member of the class Matrix) of the class. Along with it, define a function called displayMatrix() that can display all values of the matrix.
class named Matrix that shall contains private data member
matrix: integer type array of size 3 by 3;
constructor that should have default parameters that can set all elements to 0. Moreover,define a function called setMatrixValues(int matrixArray[3][3]) that can assign values of matrixArray (provided to the function in argument) to the matrix array (data member of the class Matrix) of the class. Along with it, define a function called displayMatrix() that can display all values of the matrix.
You are supposed to construct a class Date that shall contains the following private members
such as:
Day: integer type data.
Month: integer type data.
Year: integer type data.
You are supposed to perform operators overloading on the following operators
> : greater than operator.
< : less than operator.
== : equal operator.
Write a static method called dollarToPeso that takes a dollar amount as parameter and returns its equivalent in pesos. Assume that the conversion rate is 1 dollar = 48.45 pesos. Use this method in the program.
Sample output:
Enter dollar amount: 50
$ 50 = P 2,422.5
A car park has the following charges. The 1st hours cost RM2.00. The sub sequent hours cost RM1.00 per hour. Write a program for this problem.
Write a Java program to produce the following GUI calculator. Use exception-handling to catch any exceptions (divide by zero, or non-integer input). Display any errors in a JOptionPane message dialogue box.
Write a program that meets the following requirements:
Create an array with 10 String elements.
Create a Gui with a text field to enter an array index value and another text field to display the array element value.
Create Show Element button to cause the array element to be displayed. If the specified index is out of bounds, display an appropriate message using a JOptionpane method.
Write a Python program which iterates the integers from 1 to 50. For multiples of two print “even”, for multiples of three print “multipleOf3”, and for numbers which are multiples of both two and three print “evenmultipleOf3”, otherwise print the number. Hint: Use a loop for this problem.
Sample Output:
Sample Input
Sample Output
1
1
2
even
3
multipleOf3
4
even
5
5
6
evenmultipleOf3
…
…
14
even
15
multipleOf3
Sample Input and Output
Write a graphical user interface for an application, website, pc game, mobile games or any application that you want to develop someday. Have a short description of what the application is all about and describe each object on the GUI. In laymans term, a GUI is the overall appearance or look and feel out an application that the user is interacting by pressing a button, image or any object on a screen.
Complete the following print and if statements by accessing the appropriate elements from my_list. Hint: Use the list indexing notation []. print('My favorite color is', ???) print('I have {} pet(s).'.format(???)) if ???: print("I have previous programming experience") else: print("I do not have previous programming experience")