Write a java program where a user enters and stores the average monthly rainfall figures (int) for three (3) towns over a year. The rows represent the months, and the columns represent the towns.
Calculate and print the total rainfall figures for each town, and the average rainfall for each month. Use a switch statement to print out the month name according to the column subscript value (E.g. if col = 0, then print January, col = 1 then print February, etc.) with the corresponding total alongside it.
Write a Program: Print a table of stars and zeroes
print a square table of alternating stars and zeroes.
Ask the user to enter a size of the table. The number should be odd. Since the table is square the number of rows and columns will be the same and should be equal to the entered size. The valid range for the size is from 3 to 15, inclusive.
Use a loop to make sure the entered size is odd and within the range. Output a descriptive error message if an invalid size is entered. The error message should indicate if the size is even, or less than the minimum, or larger than the maximum.
If more than one error condition appears. Don't create separate output strings for all combinations of error conditions
Each row in said table should have ‘*’ and ‘0’ symbols separated by a space. Each column of the table should also have alternating ‘*’ and ‘0’ symbols. All corners should have the ‘*’ symbol.
Write a program to create a class called STUDENT with data members Roll
Number, Name and Age. Using inheritance, create the classes
UGSTUDENT and PGSTUDENT having fields a semester, fees and
stipend. Enter the data for at least 5 students. Find the average age for all
UG and PG students separately.
(Multipath Inheritance) Design a base class called Student with two
fields:- (i) Name (ii) roll number. Derive two classes called Sports and
Exam from the Student base class. Class Sports has a field called s_grade
and class Exam has a field called e_grade which are integer fields. Derive a
class called Results which inherit from Sports and Exam. This class has a
character array or string field to represent the final result. Also it has a
member function called display which can be be used to display the final result.Illustrate the usage of these classes in main.
write a simple application which takes data from the console and saves it to a file. The program should take the following data:
name, address and phone number. The program should have a menu which allows users to load data from previous sessions.
Write a simulation program for the fruit market. The farmer will be able to
produce different types of fruits (apple, orange, grape, and watermelon),
and put them in the market to sell. The market has limited capacity and
farmers have to stand in a queue if the capacity is exceeded to sell their
fruits. Consumers can come to the market any time and purchase their
desired fruits; and if the fruits they want to buy runs out, they are willing to
wait until the supply of that kind is ready. (Hint: implementing this market
will encounter the producer and consumer problem, and it probably needs
multiple buffers for different kinds of fruits).
Write a program called ReverseHello.java that creates a thread (let's call it
Thread 1). Thread 1 creates another thread (Thread 2); Thread 2 creates
Thread 3; and so on, up to Thread 50. Each thread should print "Hello from
Thread <num>!", but you should structure your program such that the
threads print their greetings in reverse order.
Write a menu driven program in Java to automate the ATM operations by
demonstrating the concepts of interfaces. And create custom exceptions to
deal with the following situations
a. Invalid PIN number is entered more than 3 times
b. Withdraw operation when balance amount < withdraw amount