Reference no: EM132203672
Learning Outcomes:
1. Use different program control statements in a programming language
2. Demonstrate the use of arrays with a programming language
3. Define and work with classes and objects in a programming language.
Q1. Write a java program to automate a retail shop sales operations as mentioned below: To update the stock details of items
In this, to read an Item name (String), Item code (Integer), Item Quantity (Integer),Unit Price(double) of ‘n' number of items using an array concept to insert the stock details. Then use the same array for displaying the details of existing stock inserted as per output screen given below (Fig.1) using a loop.
To make purchase, please ensure the following condition has been evaluated :
To purchase ‘n' number of items, the user must Enter an item code and check with existing stock whether the particular item is available or not, if then, the user should provide the Quantity for purchased items then it should display purchase details with ‘Total Amount' and ‘Grant Total' using any loop and array ,otherwise display "Your item is not available". (Refer Fig.2)
Q2. Write a java program to print following pattern using inner loop concept. 2
1 3
4 6 8
5 7 9 11
10 12 14 16 18
13 15 17 19 21 23
Q3. Write java program using class and object concept to read three marks scored in different modules and credit points of each module. Then perform following calculation to find cgpa and display output as per given screenshot (Fig. 3).
Calculate cgpa as per following condition and formula
If sum of credit points is greater than 20, CGPA=((mark1*credit1)+(mark2*credit2)+(mark3*credit))/(Total of all credits), Otherwise Cgpa is 0.