Dumledore’s dining table can be thought of as an infinite row of seats with Dumbledore at one end. Each of Dumbledore’s guests represents a character of English alphabet (a to z).Dumbledore wants his guests to be seated such that the resulting string formed from the alphabets should be lexicographically smallest (See examples for reference).● Seats are allotted in sequential order, a guest who arrives later must be further from Dumbledore than a guest who arrives earlier.● An incoming guest must be assigned a seat, as soon as he arrives. He will take a seat.● Once a guest takes their seat, you can’t ask them to move to some other seat. Even if the seat in front of him is empty, they will stay at their occupied seat only.● But you can make a guest disappear using your spells, Dumbledore has allowed you to make at most ‘k’ of his guests disappear. He can handle ‘k’ guests not in the party but you can’t remove more than ‘k’ guests.
Create a program where you have to design your own Java console application about any valid problem that your application must solve. Your solution can include solving a business problem, a new idea or even a game. Your application must make use of concepts such as arrays, loops, inheritance, constructors and information hiding. Output must be shown in the form of a report using the console. Use Advanced arrays & Introduction to inheritance
Write a program that prints the sum, difference, product, quotient and remainder of two numbers. Initialize the numbers with the values 44 and 2.
Using a while loop, write a program to calculate and print the sum of a given number of squares.
Create an abstract class named Book. Include a String field for the book’s
title and a double field for the book’s price. Within the class, include a
constructor that requires the book title, and add two get methods—one
that returns the title and one that returns the price. Include an abstract
method named setPrice(). Create two child classes of Book: Fiction and
NonFiction. Each must include a setPrice() method that sets the price for
all Fiction Books to $24.99 and for all NonFiction Books to $37.99. Write a
constructor for each subclass, and include a call to setPrice() within each.
Write an application demonstrating that you can create both a Fiction and
a NonFiction Book, and display their fields. Save the files as Book.java,
Fiction.java, NonFiction.java, and UseBook.java
Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these fields. Next, create a subclass named RaceHorse, which contains an additional field that holds the number of races in which the horse has competed and additional methods to get and set the new field. Write an application that demonstrates using objects of each class. Save the files as Horse.java, RaceHorse.java, and DemoHorses.java.
Write a program to print the names of students by creating a
Student class. If no name is passed while creating an object of
Student class, then the name should be "Unknown", otherwise the
name should be equal to the String value passed while creating
object of Student class.
Suppose there is a list s1->s2->s3->.........->sn-1
->sn. given to you. Write the algorithm and the pseudo code to modify this list in
such a way that it will be s1->sn
->s2->sn-1
->s3->sn-2.......
Note: algorithm should be in place without modifying the values of the nodes.
Marking Scheme: Total 10 marks ( Algorithm explanation + Pseudo-code + runtime and data
structure used)
Write a program to calculate gross and net pay of employee from
basic salary. Create employee class which consists of employee
name, emp_id, and basic salary as its data members. Use
parameterized constructor in the derived class to initialize data
members of the base class and calculate gross and net pay of the
employee in the derived class.
Gardening
We have a task to do Gardening.
Given two boolean values
isGrassTrimmerFound
and
isWaterHosePipeFound
Sample Input 1
Sample Output 1Sample Input 2Sample Output 2