Mini Grade 10 Project
Mini Grade 10 Project
Part 1:
1) A Soft drink manufacturing company offers a discount to the dealer and retailer based on
the quantity of purchase as per the following criteria.
Variables:
********
String namCus: Name of the customer.
int qty: Quantity purchased in litre.
double price: Price of one litre of soft drink .
double amount : Total amount (qty x price)
double discount: Amount discounted.
double fAmount : Final amount after discount.
● Accept namCus,qty ,price using the methods of Scanner class.
● Calculate the amount, discount ( based on the given criteria),fAmount
● Display all the details in the below format.
namCus qty price amount discount fAmount
xxxx xxxx xxxx xxxx xxxx xxxx
Use a menu-driven approach having choices (*) for Dealer and ($) for Retailer.
Note:
1) The same program should be done using the below criteria also:
a) 1 for Dealer and 2 for Retailer.
b) Dl for Dealer and Re for Retailer.
2) Try using double variables for the above choices and find out what happens.
2) Write a Java program to input the Customer name , Customer id , purchase amount .
Calculate the discount amount , final amount and decide the gift based on the table given
below.
Purchase Amount Discount (%) Gift
Less than 10000 Nil clock
10,000 to 25,000 2 Water bottle
25,001 to 50,000 3 Watch
Above 50,000 5 Silver Tumbler
Display all the details in the below format.
Name : xxxx
Id : xxxx
Amount : xxxx
Discount : xxxx
final amount : xxxx
Gift : xxxx
2)
3)
Member methods:
void accept() - accept the details using Scanner class
double calculate() - to calculate the net salary as per the given specifications and return it.
net = basic+da+hra – pf
hra = 18% of basic
da = 17.45% of basic
pf = 8.10% of basic
If the age of the employee is above 50 he/she gets an additional allowance of Rs. 5000/-
void print() - to print the details as per the given format:
Eno name age basic net
Xxx xxxx xxx xxx xxx
void main() – to create an object of the class and invoke the methods
Upto 1/2 9
> 1/2 to 1 10
> 1 to 3 11
>3 12
Write the main() method to create an object and call the above methods.
Part 2: Constructors:
Write the main method to create an object and call the above methods.
Member variables:
iii) double volume(double h ) – Returns volume by accepting height ‘h’ as the arguments and using the
formula: v = 22 / 7 × r2 × h
6) An electronics shop has announced a special discount on the purchase of Laptops as
given below:
1. name
2. price
3. dis
4. amt
Member Methods:
Write a main method to create an object of the class and call the member methods.
7) Write a class with the name Area using method overloading that computes the area of a
parallelogram, a rhombus and a trapezium.
Formula:
(where a and b are the parallel sides, h is the perpendicular distance between the parallel sides)
8)
i) void check(String str, char ch) – to find and print the frequency of a character in a
string. Example :Input: Str = “success” ch = ‘s’ Output: number of s present is=3
ii) void check (String s1) – to display only the vowels from string s1 , after converting it
to lower case. Example :Input:S1= “computer” Output: o u e
10)
11) Design a class to overload a function compare as follows:
(a) void compare (int, int) – to compare two integer values and print the greater of the two
integers.
(b) void compare (char, char ): to compare the numeric value of two characters and print
(c) void compare(String, String): to compare the length of the two strings and print the
1. void num_calc( int num, char ch) with one integer argument and one character
argument, computes the square of integer argument if choice ch is ‘s’ otherwise finds its
cube.
2. void num_calc( int a, int b, char ch ) with two integer argument and one character
argument. It computes the product of integer arguments if ch is ‘p’ else adds the
integers.
3. void num_calc( Sting s1, String s2) with two string arguments, which prints whether
(i) double series(double n) with one double argument and returns the sum of the
(ii) (ii) double series(double a, double n) with two double arguments and returns the sum
i) void check(String str, char ch) – to find and print the frequency of a character in a string.
ii) void check (String s1) – to display only the vowels from string s1 ,after converting it to lower case.
Output: o u e
23
456
(ii) boolean print (int n) to check whether the number is a Dudeney number,
Part 5: Searching :
16) Define a class to accept values into an array of integer data type of size 20. Accept a integer
value from user and search in the array using linear search method. If value is found display message
"Found" with its position where it is present in the array. Otherwise display message "not found".
a) double array
a) String array
18)Write a program in JAVA that reads the following list of countries and their respective cities into
two separate one-dimensional arrays. The program should accept the name of a country as input and
give the name of the corresponding city as an output. The program should be designed to give an
error message where a city is asked for a country whose name is not given in the list. To stop the
program, "XXX" is to be entered as input.
Sorting
19) Define a class to accept 10 integer value from a user. Using bubble sort technique, arrange them
in ascending order and descending order. Display the sorted arrays and original array.
b) char array
20)Define a class to accept 10 double value from a user. Using selection sort technique, arrange
them in ascending order and descending order. Display the sorted arrays and original array.
Part 6: 2D array
22) Two matrices are said to be equal if they have the same dimension and their corresponding
elements are equal.
For example , the two matrices A and B given below are equal:
Design a class EqMat to check if two matrices are equal or not.
23) Define a class to accept a 2D array and perform the below actions depending upon user
choice:
24) Define a class to accept values into a 3 × 3 array and check if it is a special array. An array is a
special array if the sum of the even elements = sum of the odd elements.
Example:
A[ ][ ]={{ 4 ,5, 6}, { 5 ,3, 2}, { 4, 2, 5}};
Sum of even elements = 4 + 6 + 2 + 4 + 2 = 18
Sum of odd elements = 5 + 5 + 3 + 5 = 18
25)
26)