Employee Salary Calculation System
Employee Salary Calculation System
Casual Employee:
public class CasualEmployee extends Employee{
}
Employee:
public abstract class Employee {
}
User Interface:
import [Link];
public class UserInterface {
[Link] Cinemas
Gold Ticket:
public class GoldTicket extends BookAMovieTicket {
public GoldTicket(String ticketId, String customerName, long mobileNumber,
String emailId, String movieName) {
super(ticketId, customerName, mobileNumber, emailId, movieName);
}
public boolean validateTicketId(){
int count=0;
if([Link]("GOLD"));
count++;
char[] cha=[Link]();
for(int i=4;i<7;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
}
if(count==4)
return true;
else
return false;
}
public double calculateTicketCost(int numberOfTickets,String ACFacility){
double amount;
if([Link]("yes")){
amount=500*numberOfTickets;
}
else{
amount=350*numberOfTickets;
}
return amount;
}
}
Platinum Ticket:
public class PlatinumTicket extends BookAMovieTicket
{
public PlatinumTicket(String ticketId, String customerName, long mobileNumber,String
emailId, String movieName)
{
super(ticketId, customerName, mobileNumber, emailId, movieName);
}
public boolean validateTicketId(){
int count=0;
if([Link]("PLATINUM"));
count++;
char[] cha=[Link]();
for(int i=8;i<11;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
}
if(count==4)
return true;
else
return false;
}
public double calculateTicketCost(int numberOfTickets,String ACFacility){
double amount;
if([Link]("yes")){
amount=750*numberOfTickets;
}
else{
amount=600*numberOfTickets;
}
return amount;
}
}
Silver Ticket:
public class SilverTicket extends BookAMovieTicket{
public SilverTicket(String ticketId, String customerName, long mobileNumber,String emailId,
String movieName)
{
super(ticketId, customerName, mobileNumber, emailId, movieName);
}
public boolean validateTicketId(){
int count=0;
if([Link]("SILVER"));
count++;
char[] cha=[Link]();
for(int i=6;i<9;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
}
if(count==4)
return true;
else
return false;
}
public double calculateTicketCost(int numberOfTickets,String ACFacility){
double amount;
if([Link]("yes")){
amount=250*numberOfTickets;
}
else{
amount=100*numberOfTickets;
}
return amount;
}
}
User Interface:
import [Link].*;
public class UserInterface {
public static void main(String[] args) {
Scanner sc=new Scanner([Link]);
[Link]("Enter Ticket Id");
String tid=[Link]();
[Link]("Enter Customer Name");
String cnm=[Link]();
[Link]("Enter Mobile Number");
long mno=[Link]();
[Link]("Enter Email id");
String email=[Link]();
[Link]("Enter Movie Name");
String mnm=[Link]();
[Link]("Enter number of tickets");
int tno=[Link]();
[Link]("Do you want AC or not");
String choice =[Link]();
if([Link]("PLATINUM")){
PlatinumTicket PT=new PlatinumTicket(tid,cnm,mno,email,mnm);
boolean b1=[Link]();
if(b1==true){
double cost =[Link](tno, choice);
[Link]("Ticket cost is "+ cost);
}
else if(b1==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
else if([Link]("GOLD")){
GoldTicket GT=new GoldTicket(tid,cnm,mno,email,mnm);
boolean b2=[Link]();
if(b2==true){
double cost=[Link](tno, choice);
[Link]("Ticket cost is "+cost);
}
else if (b2==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
else if([Link]("SILVER")){
SilverTicket ST=new SilverTicket(tid,cnm,mno,email,mnm);
boolean b3=[Link]();
if(b3==true){
double cost=[Link](tno, choice);
[Link]("Ticket cost is "+cost);
}
else if(b3==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
}
}
[Link] Innovators
Main:
import [Link].*;
public class Main {
Air Conditioner:
public class AirConditioner extends ElectronicProducts {
private String airConditionerType;
private double capacity;
public AirConditioner(String productId, String productName, String batchId, String
dispatchDate, int warrantyYears, String airConditionerType, double capacity) {
super(productId, productName, batchId, dispatchDate, warrantyYears);
[Link] = airConditionerType;
[Link] = capacity;
}
public String getAirConditionerType() {
return airConditionerType;
}
public void setAirConditionerType(String airConditionerType) {
[Link] = airConditionerType;
}
public double getCapacity() {
return capacity;
}
public void setCapacity(double capacity) {
[Link] = capacity;
}
public double calculateProductPrice(){
double price = 0;
if([Link]("Residential")){
if (capacity == 2.5){
price = 32000;
}
else if(capacity == 4){
price = 40000;
}
else if(capacity == 5.5){
price = 47000;
}
}
else if([Link]("Commercial")){
if (capacity == 2.5){
price = 40000;
}
else if(capacity == 4){
price = 55000;
}
else if(capacity == 5.5){
price = 67000;
}
}
else if([Link]("Industrial")){
if (capacity == 2.5){
price = 47000;
}
else if(capacity == 4){
price = 60000;
}
else if(capacity == 5.5){
price = 70000;
}
}
return price;
}
}
Electronic Products:
public class ElectronicProducts {
protected String productId;
protected String productName;
protected String batchId;
protected String dispatchDate;
protected int warrantyYears;
public ElectronicProducts(String productId, String productName, String batchId,
String dispatchDate, int warrantyYears) {
[Link] = productId;
[Link] = productName;
[Link] = batchId;
[Link] = dispatchDate;
[Link] = warrantyYears;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
[Link] = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
[Link] = productName;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
[Link] = batchId;
}
public String getDispatchDate() {
return dispatchDate;
}
public void setDispatchDate(String dispatchDate) {
[Link] = dispatchDate;
}
public int getWarrantyYears() {
return warrantyYears;
}
public void setWarrantyYears(int warrantyYears) {
[Link] = warrantyYears;
}
}
LED TV:
public class LEDTV extends ElectronicProducts {
private int size;
private String quality;
public LEDTV(String productId, String productName, String batchId, String
dispatchDate, int warrantyYears, int size, String quality) {
super(productId, productName, batchId, dispatchDate, warrantyYears);
[Link] = size;
[Link] = quality;
}
public int getSize() {
return size;
}
public void setSize(int size) {
[Link] = size;
}
public String getQuality() {
return quality;
}
public void setQuality(String quality) {
[Link] = quality;
}
public double calculateProductPrice(){
double price = 0;
if([Link]("Low")){
price = size * 850;
}
else if([Link]("Medium")){
price = size * 1250;
}
else if([Link]("High")){
price = size * 1550;
}
return price;
}
}
Microwave Oven:
public class MicrowaveOven extends ElectronicProducts{
private int quantity;
private String quality;
public MicrowaveOven(String productId, String productName, String batchId, String
dispatchDate, int warrantyYears, int quantity, String quality) {
super(productId, productName, batchId, dispatchDate, warrantyYears);
[Link] = quantity;
[Link] = quality;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
[Link] = quantity;
}
public String getQuality() {
return quality;
}
public void setQuality(String quality) {
[Link] = quality;
}
public double calculateProductPrice(){
double price = 0;
if([Link]("Low")){
price = quantity * 1250;
}
else if([Link]("Medium")){
price = quantity * 1750;
}
else if([Link]("High")){
price = quantity * 2000;
}
return price;
}
}
User Interface:
import [Link];
public class UserInterface {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter Product Id");
String productId = [Link]();
[Link]("Enter Product Name");
String productName = [Link]();
[Link]("Enter Batch Id");
String batchId = [Link]();
[Link]("Enter Dispatch Date");
String dispatchDate = [Link]();
[Link]("Enter Warranty Years");
int warrantyYears = [Link]();
double price;
String quality;
switch(productName){
case "AirConditioner":
[Link]("Enter type of Air Conditioner");
String type = [Link]();
[Link]("Enter quantity");
double capacity = [Link]();
AirConditioner ac = new AirConditioner(productId, productName, batchId,
dispatchDate, warrantyYears, type, capacity);
price = [Link]();
[Link]("Price of the product is %.2f", price);
break;
case "LEDTV":
[Link]("Enter size in inches");
int size = [Link]();
[Link]("Enter quality");
quality = [Link]();
LEDTV l = new LEDTV(productId, productName, batchId, dispatchDate,
warrantyYears, size, quality);
price = [Link]();
[Link]("Price of the product is %.2f", price);
break;
case "MicrowaveOven":
[Link]("Enter quantity");
int quantity = [Link]();
[Link]("Enter quality");
quality = [Link]();
MicrowaveOven m = new MicrowaveOven(productId, productName, batchId,
dispatchDate, warrantyYears, quantity, quality);
price = [Link]();
[Link]("Price of the product is %.2f", price);
break;
default:
[Link]("Provide a valid Product name");
[Link](0);
}
}
}
5. Reverse a word
import [Link].*;
class HelloWorld {
public static void main(String[] args) {
String[] words ;
Scanner myObj = new Scanner([Link]);
[Link](words[[Link]-1]);
// reverse StringBuilder input1
input1= [Link]();
[Link](words[0]);
[Link](input1);
}
else {
[Link](words[0]);
// reverse StringBuilder input1
input1= [Link]();
[Link](words[[Link]-1]);
[Link](input1);
}
}
}
}
Group -1
1. AirVoice - Registration
SmartBuy is a leading mobile shop in the town. After buying a product, the customer needs to
provide a few personal details for the invoice to be generated.
You being their software consultant have been approached to develop software to retrieve the
personal details of the customers, which will help them to generate the invoice faster.
String emailId
int age
Get the details as shown in the sample input and assign the value for its attributes using the
setters.
Display the details as shown in the sample output using the getters method.
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes and methods as specified in the question.
Sample Input 1:
john
9874561230
john@[Link]
32
Sample Output 1:
Name:john
ContactNumber:9874561230
EmailId:john@[Link]
Age:32
Automatic evaluation[+]
[Link]
[Link]
1 import [Link];
2
3 public class Main {
4
5 public static void main(String[] args) {
6 // TODO Auto-generated method stub
7 Scanner sc=new Scanner([Link]);
8 Customer c=new Customer();
9 [Link]("Enter the Name:");
10 String name=([Link]());
11 [Link]("Enter the ContactNumber:");
12 long no=[Link]();
13 [Link]();
14 [Link]("Enter the EmailId:");
15 String mail=[Link]();
16
17 [Link]("Enter the Age:");
18 int age=[Link]();
19 [Link](name);
20 [Link](no);
21 [Link](mail);
22 [Link](age);
23 [Link]("Name:"+[Link]());
24 [Link]("ContactNumber:"+[Link]());
25 [Link]("EmailId:"+[Link]());
26 [Link]("Age:"+[Link]());
27
28
29
30 }
31
32 }
Grade
Reviewed on Monday, 7 February 2022, 4:45 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
=================================================================================
2. Payment - Inheritance
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
Payment Status
Roy is a wholesale cloth dealer who sells cloth material to the local tailors on monthly
installments. At the end of each month, he collects the installment amount from all his customers.
Some of his customers pay by Cheque, some pay by Cash and some by Credit Card. He wants
to automate this payment process.
The application needs to verify the payment process and display the status report of payment by
getting the inputs like due amount, payment mode and data specific to the payment mode from
the user and calculate the balance amount.
Note:
Date
dateOfIssue
Make payment Cheque public boolean This is an overridden method
for EMI payAmount() of the parent class. It should
amount return true if the cheque is
valid and the amount is valid.
Else return false.
Note:
int
creditCardAmount
Make Credit public boolean This is an overridden method of
payment for payAmount() the parent class. It should deduct
EMI amount the dueAmount and service tax
from the creditCardAmount and
return true if the credit card
payment was done successfully.
Else return false.
Note:
· The payment can be done if the credit card amount is greater than or equal to the sum of
due amount and service tax. Else payment cannot be made.
· The cardType can be “silver” or “gold” or “platinum”. Set the creditCardAmount based on
the cardType.
· The boolean payAmount() method should deduct the due amount and the service tax
amount from a credit card. If the creditCardAmount is less than the dueAmount+serviceTax, then
the payment cannot be made.
· The balance in credit card amount after a successful payment should be updated in the
creditCardAmount by deducting the sum of dueAmount and serviceTax from creditCardAmount
itself.
Note:
· If the payment is successful, processPayment method should return a message “Payment
done successfully via cash” or “Payment done successfully via cheque” or “Payment done
successfully via creditcard. Remaining amount in your <<cardType>> card is <<balance in
CreditCardAmount>>”
· If the payment is a failure, then return a message “Payment not done and your due amount
is <<dueAmount>>”
Create a public class Main with the main method to test the application.
Note:
· In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the rest of the text represents the output.
· Ensure to provide the names for classes, attributes and methods as specified in the
question.
Sample Input 1:
3000
Enter the mode of payment(cheque/cash/credit):
cash
Enter the cash amount:
2000
Sample Output 1:
Sample Input 2:
3000
Enter the mode of payment(cheque/cash/credit):
cash
Enter the cash amount:
3000
Sample Output 2:
Sample Input 3:
3000
Enter the mode of payment(cheque/cash/credit):
cheque
Enter the cheque number:
123
Enter the cheque amount:
3000
Enter the date of issue:
21-08-2019
Sample Output 3:
Sample Input 4:
3000
Enter the mode of payment(cheque/cash/credit):
credit
Enter the credit card number:
234
Enter the card type(silver,gold,platinum):
silver
Sample Output 4:
Payment done successfully via credit card. Remaining amount in your silver card is 6940
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 public class Main {
6
7 public static void main(String[] args) {
8
9 Scanner sc=new Scanner([Link]);
10 [Link]("Enter the due amount:");
11 int dueAmount=[Link]();
12
13 [Link]("Enter the mode of payment(cheque/cash/credit):");
14 String mode=[Link]();
15 Bill b = new Bill();
16 if([Link]("cheque"))
17 {
18 [Link]("enter the cheque number:");
19 String chequeNumber=[Link]();
20 [Link]("enter the cheque amount:");
21 int chequeAmount=[Link]();
22 [Link]("enter the date of issue:");
23 String date=[Link]();
24 SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
25 Date dateOfIssue=null;
26 try
27 {
28 dateOfIssue = [Link](date);
29 }
30 catch (ParseException e)
31 {
32
33 }
34 Cheque cheque= new Cheque();
35 [Link](chequeNumber);
36 [Link](chequeAmount);
37 [Link](dateOfIssue);
38 [Link](dueAmount);
39 [Link]([Link](cheque));
40 }
41 else if([Link]("cash"))
42 {
43 [Link]("enter the cash amount:");
44 int CashAmount=[Link]();
45 Cash cash=new Cash();
46 [Link](CashAmount);
47 [Link](dueAmount);
48 [Link]([Link](cash));
49 }
50 else if([Link]("credit"))
51 {
52 [Link]("enter the credit card number:");
53 int creditCardNumber=[Link]();
54 [Link]("enter the card type:");
55 String cardType=[Link]();
56
57 Credit credit=new Credit();
58 [Link](creditCardNumber);
59 [Link](cardType);
60 [Link](dueAmount);
61 [Link]([Link](credit));
62 }
63 }
64 }
[Link]
1 public class Payment {
2 private int dueAmount;
3
4 public boolean payAmount()
5 {
6 if(dueAmount == 0)
7 return true;
8 else
9 return false;
10 }
11
12 public int getDueAmount() {
13 return dueAmount;
14 }
15
16 public void setDueAmount(int dueAmount) {
17 [Link] = dueAmount;
18 }
19 }
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 public class Cheque extends Payment {
5 String chequeNo;
6 int chequeAmount;
7 Date dateOfIssue;
8 public String getChequeNo() {
9 return chequeNo;
10 }
11 public void setChequeNo(String chequeNo) {
12 [Link] = chequeNo;
13 }
14 public int getChequeAmount() {
15 return chequeAmount;
16 }
17 public void setChequeAmount(int chequeAmount) {
18 [Link] = chequeAmount;
19 }
20 public Date getDateOfIssue() {
21 return dateOfIssue;
22 }
23 public void setDateOfIssue(Date dateOfIssue) {
24 [Link] = dateOfIssue;
25 }
26
27 @Override
28 public boolean payAmount()
29 {
30 SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
31 Date today = new Date();
32 try
33 {
34 today = [Link]("01-01-2020");
35 }
36 catch (ParseException e)
37 {
38 return false;
39 }
40 long diff = [Link]()-[Link]();
41 int day = (int) [Link](diff/(1000*60*60*24));
42 int month = day/30;
43 if(month <=6)
44 {
45
46 if(chequeAmount>=getDueAmount())
47 {
48 return true;
49 }
50 else
51 return false;
52
53 }
54 else
55 return false;
56 }
57
58
59 }
[Link]
1 public class Cash extends Payment {
2 int cashAmount;
3
4 public int getCashAmount() {
5 return cashAmount;
6 }
7
8 public void setCashAmount(int cashAmount) {
9 [Link] = cashAmount;
10 }
11
12 @Override
13 public boolean payAmount()
14 {
15 if(cashAmount>=getDueAmount())
16 return true;
17 else
18 return false;
19 }
20
21
22 }
[Link]
1 public class Credit extends Payment {
2 int creditCardNo;
3 String cardType;
4 int creditCardAmount;
5 public int getCreditCardNo() {
6 return creditCardNo;
7 }
8 public void setCreditCardNo(int creditCardNo) {
9 [Link] = creditCardNo;
10 }
11 public String getCardType() {
12 return cardType;
13 }
14 public void setCardType(String cardType) {
15 [Link] = cardType;
16 }
17 public int getCreditCardAmount() {
18 return creditCardAmount;
19 }
20 public void setCreditCardAmount(int creditCardAmount) {
21 [Link] = creditCardAmount;
22 }
23
24
25 @Override
26 public boolean payAmount()
27 {
28 int netAmount = 0;
29 if([Link]("silver"))
30 {
31 netAmount = (int) (getDueAmount()*1.02);
32 creditCardAmount = 10000;
33 }
34 else if([Link]("gold"))
35 {
36 netAmount = (int) (getDueAmount()*1.05);
37 creditCardAmount = 50000;
38 }
39 else if([Link]("platinum"))
40 {
41 netAmount = (int) (int) (getDueAmount()*1.1);
42 creditCardAmount = 100000;
43 }
44
45 if(creditCardAmount>=netAmount)
46 {
47 creditCardAmount = creditCardAmount - netAmount;
48 return true;
49 }
50 else
51 return false;
52 }
53
54
55 }
[Link]
1 public class Bill {
2 public String processPayment(Payment obj)
3{
4 String res="";
5 if(obj instanceof Cheque)
6 {
7 if([Link]())
8 res = "Payment done successfully via cheque";
9 else
10 res = "Payment not done and your due amount is
"+[Link]();
11 }
12 else if(obj instanceof Cash)
13 {
14 if([Link]())
15 res = "Payment done successfully via cash";
16 else
17 res = "Payment not done and your due amount is
"+[Link]();
18 }
19 else if(obj instanceof Credit)
20 {
21 Credit c = (Credit) obj;
22 if([Link]())
23 res = "Payment done successfully via credit card. Remaining
amount in your "+[Link]()+" card is "+[Link]();
24 else
25 res = "Payment not done and your due amount is
"+[Link]();
26 }
27 return res;
28 }
29 }
Grade
Reviewed on Wednesday, 1 December 2021, 10:08 PM by Automatic grade
Grade 100 / 100
Assessment report
TEST CASE PASSED
[+]Grading and Feedback
[Link] Progress
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Andrews taught exponential multiplication to his daughter and gave her two inputs.
Assume, the first input as M and the second input as N. He asked her to find the sequential
power of M until N times. For Instance, consider M as 3 and N as 5. Therefore, 5 times the power
is incremented gradually from 1 to 5 such that, 3^1=3, 3^2=9,3^3=27,3^4=81,3^5=243. The input
numbers should be greater than zero Else print “<Input> is an invalid”. The first Input must be
less than the second Input, Else print "<first input> is not less than <second input>".
Write a Java program to implement this process programmatically and display the output in
sequential order. ( 3^3 means 3*3*3 ).
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Sample Input 1:
3
5
Sample Output 1:
3 9 27 81 243
Explanation: Assume the first input as 3 and second input as 5. The output is to be displayed
are based on the sequential power incrementation. i.e., 3(3) 9(3*3) 27(3*3*3) 81(3*3*3*3)
243(3*3*3*3*3)
Sample Input 2:
-3
Sample Output 2:
-3 is an invalid
Sample Input 3:
3
0
Sample Output 3:
0 is an invalid
Sample Input 4:
4
2
Sample Output 4:
4 is not less than 2
Automatic evaluation[+]
[Link]
1 import [Link].*;
2 public class Main
3{
4 public static void main(String[] args)
5 {
6 Scanner sc=new Scanner([Link]);
7 //Fill the code
8 int m=[Link]();
9 if(m<=0){
10 [Link](""+m+" is an invalid");
11 return;
12 }
13 int n=[Link]();
14 if(n<=0){
15 [Link](""+n+" is an invalid");
16 return;
17 }
18 if(m>=n){
19 [Link](""+m+" is not less than "+n);
20 return;
21 }
22 for(int i=1;i<=n;i++){
23 [Link]((int)[Link](m,i)+"");
24 }
25 }
26 }
Grade
Reviewed on Monday, 7 February 2022, 4:46 PM by Automatic grade
Grade 100 / 100
Assessment report
TEST CASE PASSED
[+]Grading and Feedback
4. ZeeZee bank
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
ZeeZee is a leading private sector bank. In the last Annual meeting, they decided to give their
customer a 24/7 banking facility. As an initiative, the bank outlined to develop a stand-alone
device that would offer deposit and withdrawal of money to the customers anytime.
You being their software consultant have been approached to develop software to implement
the functionality of deposit and withdrawal anytime.
As per this requirement, the customer should be able to deposit money into his account at any
time and the deposited amount should reflect in his account balance.
Deposit amount to Account public void deposit(double This method takes the
an account depositAmt) amount to be deposited as
an argument
As per this requirement, the customer should be able to withdraw money from his account
anytime he wants. The amount to be withdrawn should be less than or equal to the balance in
the account. After the withdrawal, the account should reflect the balance amount
In the Main class, Get the details as shown in the sample input.
Create an object for the Account class and invoke the deposit method to deposit the amount
and withdraw method to withdraw the amount from the account.
Note:
If the balance amount is insufficient then display the message as shown in the Sample Input /
Output.
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes, and methods as specified in the question.
Sample Input/Output 1:
1234567890
15000
1500
500
Sample Input/Output 2:
1234567890
15000
Enter the amount to be deposited:
1500
18500
Insufficient balance
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4
5
6 public class Main{
7 static Account ac=new Account(0, 0);
8 public static void main (String[] args) {
9 Scanner sc=new Scanner([Link]);
10 [Link]("Enter the account number:");
11 [Link]([Link]());
12 [Link]("Enter the available amount in the account:");
13 [Link]([Link]());
14 [Link]("Enter the amount to be deposited:");
15 [Link]([Link]());
16 [Link]("Available balance is:%.2f",[Link]());
17 [Link]();
18 [Link]("Enter the amount to be withdrawn:");
19 [Link]([Link]());
20 [Link]("Available balance is:%.2f",[Link]());
21 //Fill the code
22 }
23 }
24
25
26
[Link]
1
2 public class Account {
3 long accountNumber;
4 double balanceAmount;
5
6
7 public Account(long accno, double bal){
8 super();
9 [Link]=accno;
10 [Link]=bal;
11 }
12 public long getAccountNumber(){
13 return accountNumber;
14 }
15 public void setAccountNumber(long accno){
16 [Link]=accno;
17 }
18 public double getBalanceAmount(){
19 return balanceAmount;
20 }
21 public void setBalanceAmount(double bal) {
22 [Link]=bal;
23 }
24 public void deposit(double depositAmt){
25 float total=(float)(balanceAmount+depositAmt);
26 balanceAmount=total;
27 }
28 public boolean withdraw(double withdrawAmt){
29 float total;
30 if(withdrawAmt>balanceAmount){
31 [Link]("Insufficient balance");
32
33 return false;
34 }else{
35 total=(float)(balanceAmount-withdrawAmt);
36 setBalanceAmount(total);
37 return true;
38 }
39 }
40 }
Grade
Reviewed on Monday, 7 February 2022, 4:47 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
5. Reverse a word
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Reverse a word
Rita and Brigitha want to play a game. That game is to check the first letter of each word in a
given sentence (Case Insensitive). If it is equal, then reverse the last word and concatenate the
first word. Else reverse the first word and concatenate the last word. Create a Java application
and help them to play the game
Note:
● Sentence must contain at least 3 words else print "Invalid Sentence" and terminate the
program
● Each word must contain alphabet only else print "Invalid Word" and terminate the
program
● Check the first letter of each word in a given sentence (Case Insensitive). If it is equal,
then reverse the last word and concatenate the first word and print. Else reverse the first
word and concatenate the last word and print.
● Print the output without any space.
Sample Input 1:
Sample Output 1:
sllehsaesSea
Sample Input 2:
Sample Output 2:
maSdays
Sample Input 3:
Welcome home
Sample Output 3:
Invalid Sentence
Sample Input 4:
Friendly fire fighting fr@gs.
Sample Output 4:
Invalid Word
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link].*;
3 import [Link].*;
4 public class Main{
5 public static void main(String[] args){
6 String[] words;
7 Scanner read =new Scanner([Link]);
8 String sentence=[Link]();
9 words=[Link](" ");
10 if([Link]<3)
11 [Link]("Invalid Sentence");
12 else{
13 String a=words[0].substring(0,1);
14 String b=words[1].substring(0,1);
15 String c=words[2].substring(0,1);
16 if([Link](b)&&[Link](c))
17 {
18 StringBuilder k= new StringBuilder();
19 [Link](words[[Link]-1]);
20 k=[Link]();
21 [Link](words[0]);
22 [Link](k);
23 }
24 else{
25 StringBuilder k = new StringBuilder();
26 [Link](words[0]);
27 k=[Link]();
28 [Link](words[[Link]-1]);
29 [Link](k);
30 }
31 }
32 }
33 }
Grade
Reviewed on Monday, 7 February 2022, 5:12 PM by Automatic grade
Grade 90 / 100
Assessment report
Fail 1 -- test5_CheckForTheSentenceContainsOtherThanAlphabets::
$Expected output:"[Invalid Word]" Actual output:"[tahWme]"$
[+]Grading and Feedback
6. Dominion cinemas
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Dominion cinema is a famous theatre in the city. It has different types of seat tiers – Platinum,
Gold and Silver. So far the management was manually calculating the ticket cost for all their
customers which proved very hectic and time consuming. Going forward they want to calculate
ticket cost using their main computer. Assist them in calculating and retrieving the amount to be
paid by the Customer.
The application needs to calculate the ticket cost to be paid by the Customer according to the
seat tier.
Note:
Note:
Use a public class UserInterface with the main method to test the application. In the main
method call the validateTicketId() method, if the method returns true display the amount else
display "Provide valid Ticket Id".
Note:
● In the Sample Input / Output provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
● Ensure to follow the object oriented specifications provided in the question.
● Ensure to provide the names for classes, attributes and methods as specified in the
question.
● Adhere to the code template, if provided.
Sample Input 1:
Enter Ticket Id
SILVER490
Venkat
9012894578
Enter Email Id
venkat@[Link]
Avengers
8
Do you want AC or not
Sample Input 2:
Enter Ticket Id
ACN450
Kamal
9078561093
Enter Email Id
kamal@[Link]
Tangled
Automatic evaluation[+]
[Link]
1
2 public class BookAMovieTicket {
3
4 protected String ticketId;
5 protected String customerName;
6 protected long mobileNumber;
7 protected String emailId;
8 protected String movieName;
9
10 public String getTicketId() {
11 return ticketId;
12 }
13 public void setTicketId(String ticketId) {
14 [Link] = ticketId;
15 }
16 public String getCustomerName() {
17 return customerName;
18 }
19 public void setCustomerName(String customerName) {
20 [Link] = customerName;
21 }
22 public long getMobileNumber() {
23 return mobileNumber;
24 }
25 public void setMobileNumber(long mobileNumber) {
26 [Link] = mobileNumber;
27 }
28 public String getEmailId() {
29 return emailId;
30 }
31 public void setEmailId(String emailId) {
32 [Link] = emailId;
33 }
34 public String getMovieName() {
35 return movieName;
36 }
37 public void setMovieName(String movieName) {
38 [Link] = movieName;
39 }
40
41 public BookAMovieTicket(String ticketId, String customerName, long mobileNumber, String emailId,
String movieName) {
42 [Link] = ticketId;
43 [Link] = customerName;
44 [Link] = mobileNumber;
45 [Link] = emailId;
46 [Link] = movieName;
47
48 }
49
50
51
52 }
53
[Link]
1
2 public class GoldTicket extends BookAMovieTicket{
3 public GoldTicket(String ticketId,String customerName, long mobileNumber,
4 String emailId, String movieName){
5 super(ticketId, customerName, mobileNumber, emailId, movieName);
6 }
7
8 public boolean validateTicketId(){
9 int count=0;
10 if([Link]("GOLD"));
11 count++;
12 char[] cha=[Link]();
13 for(int i=4;i<7;i++){
14 if(cha[i]>='1'&& cha[i]<='9')
15 count++;
16 }
17 if(count==4)
18 return true;
19 else
20 return false;
21 }
22
23
24 // Include Constructor
25
26 public double calculateTicketCost(int numberOfTickets, String ACFacility){
27 double amount;
28 if([Link]("yes")){
29 amount=500*numberOfTickets;
30 }
31 else{
32 amount=350*numberOfTickets;
33 }
34
35 return amount;
36 }
37
38 }
[Link]
[Link]
1
2 public class SilverTicket extends BookAMovieTicket{
3 public SilverTicket(String ticketId, String customerName, long mobileNumber,
4 String emailId, String movieName){
5 super(ticketId, customerName, mobileNumber, emailId, movieName);
6 }
7
8 public boolean validateTicketId(){
9 int count=0;
10 if([Link]("SILVER"));
11 count++;
12 char[] cha=[Link]();
13 for(int i=6;i<9;i++){
14 if(cha[i]>='1'&& cha[i]<='9')
15 count++;
16 }
17 if(count==4)
18 return true;
19 else
20 return false;
21 }
22
23 // Include Constructor
24
25 public double calculateTicketCost(int numberOfTickets, String ACFacility){
26 double amount;
27 if([Link]("yes")){
28 amount=250*numberOfTickets;
29 }
30 else{
31 amount=100*numberOfTickets;
32 }
33
34 return amount;
35 }
36
37 }
38
[Link]
1 import [Link].*;
2
3 public class UserInterface {
4
5 public static void main(String[] args){
6 Scanner sc=new Scanner([Link]);
7 [Link]("Enter Ticket Id");
8 String tid=[Link]();
9 [Link]("Enter Customer name");
10 String cnm=[Link]();
11 [Link]("Enter Mobile number");
12 long mno=[Link]();
13 [Link]("Enter Email id");
14 String email=[Link]();
15 [Link]("Enter Movie name");
16 String mnm=[Link]();
17 [Link]("Enter number of tickets");
18 int tno=[Link]();
19 [Link]("Do you want AC or not");
20 String choice =[Link]();
21 if([Link]("PLATINUM")){
22 PlatinumTicket PT= new PlatinumTicket(tid,cnm,mno,email,mnm);
23 boolean b1=[Link]();
24 if(b1==true){
25 double cost=[Link](tno, choice);
26 [Link]("Ticket cost is "+[Link]("%.2f",cost));
27 }
28 else if(b1==false){
29 [Link]("Provide valid Ticket Id");
30 [Link](0);
31 }
32 }
33 else if([Link]("GOLD")){
34 GoldTicket GT= new GoldTicket(tid,cnm,mno,email,mnm);
35 boolean b2=[Link]();
36 if(b2==true){
37 double cost=[Link](tno,choice);
38 [Link]("Ticket cost is "+[Link]("%.2f",cost));
39 }
40 else if (b2==false){
41 [Link]("Provide valid Ticket Id");
42 [Link](0);
43 }
44 }
45 else if([Link]("SILVER")){
46 SilverTicket ST= new SilverTicket(tid,cnm,mno,email,mnm);
47 boolean b3=[Link]();
48 if(b3==true){
49 double cost=[Link](tno,choice);
50 [Link]("Ticket cost is "+[Link]("%.2f",cost));
51 }
52 else if (b3==false){
53 [Link]("Provide valid Ticket Id");
54 [Link](0);
55 }
56 }
57 }
58 }
59
60
Grade
Reviewed on Monday, 7 February 2022, 4:18 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
============================================================================
Group-2
1. Flight record retrieval
Grade settings: Maximum grade: 100
Based on: JAVA CC JDBC - MetaData V1 - ORACLE (w/o Proj Struc)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 32 s
You being their software consultant have been approached by them to develop an application
which can be used for managing their business. You need to implement a java program to view
all the flight based on source and destination.
int
noOfSeats
double
flightFare
Note: The class and methods should be declared as public and all the attributes should be
declared as private.
Requirement 1: Retrieve all the flights with the given source and destination
The customer should have the facility to view flights which are from a particular source to
destination. Hence the system should fetch all the flight details for the given source and
destination from the database. Those flight details should be added to a ArrayList and return the
same.
The flight table is already created at the backend. The structure of flight table is:
To connect to the database you are provided with [Link] file and [Link] file. (Do
not change any values in [Link] file)
Create a class called Main with the main method and get the inputs
like source and destination from the user.
Display the details of flight such as flightId, noofseats and flightfare for all the flights returned
as ArrayList<Flight> from the
method viewFlightBySourceDestination in FlightManagementSystem class.
If no flight is available in the list, the output should be “No flights available for the given source
and destination”.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
Malaysia
Singapore
18221 50 5000.0
Malaysia
Dubai
Automatic evaluation[+]
[Link]
1
2 public class Flight {
3
4 private int flightId;
5 private String source;
6 private String destination;
7 private int noOfSeats;
8 private double flightFare;
9 public int getFlightId() {
10 return flightId;
11 }
12 public void setFlightId(int flightId) {
13 [Link] = flightId;
14 }
15 public String getSource() {
16 return source;
17 }
18 public void setSource(String source) {
19 [Link] = source;
20 }
21 public String getDestination() {
22 return destination;
23 }
24 public void setDestination(String destination) {
25 [Link] = destination;
26 }
27 public int getNoOfSeats() {
28 return noOfSeats;
29 }
30 public void setNoOfSeats(int noOfSeats) {
31 [Link] = noOfSeats;
32 }
33 public double getFlightFare() {
34 return flightFare;
35 }
36 public void setFlightFare(double flightFare) {
37 [Link] = flightFare;
38 }
39 public Flight(int flightId, String source, String destination,
40 int noOfSeats, double flightFare) {
41 super();
42 [Link] = flightId;
43 [Link] = source;
44 [Link] = destination;
45 [Link] = noOfSeats;
46 [Link] = flightFare;
47 }
48
49
50
51 }
52
[Link]
1 import [Link];
2 import [Link].*;
3
4
5 public class FlightManagementSystem {
6
7 public ArrayList<Flight> viewFlightBySourceDestination(String source, String destination){
8 ArrayList<Flight> flightList = new ArrayList<Flight>();
9 try{
10 Connection con = [Link]();
11
12 String query="SELECT * FROM flight WHERE source= '" + source + "' AND destination= '" +
destination + "' ";
13
14 Statement st=[Link]();
15
16 ResultSet rst= [Link](query);
17
18 while([Link]()){
19 int flightId= [Link](1);
20 String src=[Link](2);
21 String dst=[Link](3);
22 int noofseats=[Link](4);
23 double flightfare=[Link](5);
24
25 [Link](new Flight(flightId, src, dst, noofseats, flightfare));
26 }
27 }catch(ClassNotFoundException | SQLException e){
28 [Link]();
29 }
30 return flightList;
31 }
32
33 }
[Link]
1 import [Link];
2 import [Link];
3
4 public class Main{
5 public static void main(String[] args){
6 Scanner sc=new Scanner([Link]);
7 [Link]("Enter the source");
8 String source=[Link]();
9 [Link]("Enter the destination");
10 String destination=[Link]();
11
12 FlightManagementSystem fms= new FlightManagementSystem();
13 ArrayList<Flight> flightList=[Link](source,destination);
14 if([Link]()){
15 [Link]("No flights available for the given source and destination");
16 return;
17 }
18 [Link]("Flightid Noofseats Flightfare");
19 for(Flight flight : flightList){
20 [Link]([Link]()+" "+[Link]()+" "+[Link]());
21 }
22
23 }
24 }
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7
8 public class DB {
9
10 private static Connection con = null;
11 private static Properties props = new Properties();
12
13
14 //ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
15 public static Connection getConnection() throws ClassNotFoundException, SQLException {
16 try{
17
18 FileInputStream fis = null;
19 fis = new FileInputStream("[Link]");
20 [Link](fis);
21
22 // load the Driver Class
23 [Link]([Link]("DB_DRIVER_CLASS"));
24
25 // create the connection now
26 con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),[Link]
operty("DB_PASSWORD"));
27 }
28 catch(IOException e){
29 [Link]();
30 }
31 return con;
32 }
33 }
34
[Link]
1 #IF NEEDED, YOU CAN MODIFY THIS PROPERTY FILE
2 #ENSURE YOU ARE NOT CHANGING THE NAME OF THE PROPERTY
3 #YOU CAN CHANGE THE VALUE OF THE PROPERTY
4 #LOAD THE DETAILS OF DRIVER CLASS, URL, USERNAME AND PASSWORD IN [Link] using this
properties file only.
5 #Do not hard code the values in [Link].
6
7 DB_DRIVER_CLASS=[Link]
8 DB_URL=jdbc:oracle:thin:@[Link]:1521:XE
9 DB_USERNAME=${sys:db_username}
10 DB_PASSWORD=${sys:db_password}
11
Grade
Reviewed on Monday, 7 February 2022, 6:33 PM by Automatic grade
Grade 100 / 100
Assessment report
Assessment Completed Successfully
[+]Grading and Feedback
=============================================
2. Get Text and Display Welcome Message
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
Amir owns “Bouncing Babies” an exclusive online store for baby toys.
He desires to display a welcome message whenever a customer visits his online store and
makes a purchase.
Help him do this by incorporating the customer name using the Lambda expression.
In the Main class write the main method and perform the given steps :
Note :
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Ensure to provide the name for classes, interfaces and methods as specified in the question.
Watson
Sample Output 1 :
Welcome Watson
Automatic evaluation[+]
[Link]
1 import [Link].*;
2 @FunctionalInterface
3 public interface DisplayText
4{
5 public void displayText(String text);
6 public default String getInput()
7 {
8 Scanner read = new Scanner([Link]);
9 String str = [Link]();
10 return str;
11 //return null;
12 }
13 }
[Link]
1 public class Main
2{
3 public static DisplayText welcomeMessage()
4 {
5
6 DisplayText dis = (str)->{
7
8 [Link]("Welcome "+str);
9 };
10 return dis;
11 }
12 public static void main(String args[])
13 {
14 DisplayText dis=welcomeMessage();
15 String text = [Link]();
16 [Link](text);
17
18 }
19 }
Grade
Reviewed on Wednesday, 1 December 2021, 10:14 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
=============================================
3. Generate Password
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Important Instructions:
· Do not change the Skeleton code or the package structure, method names, variable
names, return types, exception clauses, access specifiers etc.
· You can create any number of private methods inside the given class.
· You can test your code from main() method of the program
The system administrator of an organization wants to set password for all the computers for
security purpose. To generate a strong password, he wants to combine the username of each
user of the system with the reverse of their respective usernames. Help them by using Lambda
expressions that caters to their requirement.
Requirement 1: PasswordInfo
The Administrator wants to generate password for each system by making use
of the passwordGeneration method based on the username which is passed as a string.
In the Computer class write the main method and perform the given steps:
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
Ensure to use the lambda expression.
Ensure to follow the object oriented specifications provided in the question.
Ensure to provide the name for classes, interfaces and methods as specified in the
question.
Adhere to the code template, if provided.
Sample Input 1:
Enter system no
Tek/1234
Enter username
Manoj Kumar
Sample Output 1:
Password Info
=========================================================================
· Do not change the Skeleton code or the package structure, method names, variable
names, return types, exception clauses, access specifiers etc.
· You can create any number of private methods inside the given class.
· You can test your code from the main() method of the program.
Watican Museum is one of the famous museums, they have collections of houses paintings, and
sculptures from artists. The Museum management stores their visitor's details in a text file. Now,
they need an application to analyze and manipulate the visitor details based on the visitor visit
date and the visitor address.
You are provided with a text file – [Link], which contains all the visitor details
like the visitor Id, visitor name, mobile number, date of visiting and address. Your
application should satisfy the following requirements.
2. View visitor details which are above a particular mentioned visitor address.
You are provided with a code template which includes the following:
Note:
The Visitor class and the Main class will be provided with all the necessary codes. Please
do not edit or delete any line of the code in these two classes.
Fill your code in the InvalidVisitorIdException class to create a constructor as described
in the functional requirements below.
Fill your code in the respective methods of VisitorUtility class to fulfil all the functional
requirements.
In the [Link] file, each visitor detail has information separated by a comma,
and it is given as one customer detail per line.
Functional Requirements:
Fill your code in the respective class and method declarations based on the required
functionalities as given below.
Note:
Validation Rules:
Example.
WM_A23
InvalidVisitorIdException Create a constructor with a This class Should inherit the Exception
single String argument and class. The constructor should pass the
pass it to the parent class String message which is thrown to it by
constructor. calling the parent class constructor.
Requirement 2: View visitor details which are above a particular mentioned address
1. All inputs/ outputs for processing the functional requirements should be case sensitive.
2. Adhere to the Sample Inputs/ Outputs
3. In the Sample Inputs/ Outputs provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
4. All the Date values used in this application must be in “dd-MM-yyyy” format.
5. Adhere to the code template.
6. Fill all your required codes in the respective blocks. Do not edit or delete the codes
provided in the code template.
7. The Sample Inputs/ Outputs given below are generated based on the Sample data given
in the [Link] file.
8. Please do not hard code the output.
1. ViewVisitorDetailsByDateOfVisiting
2. ViewVisitorDetailsByAddress
07-04-2012
1. viewVisitorDetailsByDateOfVisiting
2. viewVisitorDetailsByAddress
Eastbourne
Requirements:
3. Retrieve the patient details which are from a particular area (address).
String
patientName
String
contactNumber
String dateOfVisit
String
patientAddress
You are provided with a text file –[Link], which contains all the patient details like the
patient Id, patient name, contact number, date of visit, and patient address. You can add any
number of records in the text file to test your code.
Note:
· In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user, and the rest of the text represents the output.
· Ensure to provide the names for classes, attributes, and methods as specified in the
question description.
Sample Input/Output 1:
1. By Date of Visit
2. By Address
Enter your choice:
02-03-2003
02-12-2005
Sample Input/Output 2:
1. By Date of Visit
2. By Address
Carolina
1. By Date of Visit
2. By Address
03-02-2020
02-02-2021
Sample Input/Output 4:
1. By Date of Visit
2. By Address
Enter your choice:
Invalid Option
Automatic evaluation[+]
HospitalManagement/[Link]
1 WM_J82,Jacey,8734909012,07-08-2001,Colorado
2 WM_L01,Bella,9435678631,21-09-1992,Connecticut
3 WM_52E,Berey,8754321256,20-03-1999,Indiana
4 WM_B83,Cappi,6709543276,13-02-2006,Pennsylvania
5 WM_C23,Anya,7656548798,23-11-2002,Carolina
6 WM_X26,Beatrice,6789567687,18-07-2004,Texas
7 WM_H72,Elise,9809908765,02-12-2005,Washington
8 WM_P10,Fanny,7835627189,02-05-2001,Virginia
9 WM_Q12,Felicity,6792637810,21-05-1997,Colorado
10 WM_K7K,Abigail,8934562718,02-05-2016,Indiana
11 WM_U82,Alice,8352617181,11-05-2012,Indiana
12 WN_P23,Amber,9876567898,12-09-1998,Pennsylvania
13 LM_V20,Gabriella,8302927382,02-05-2006,Connecticut
14 WM_Z05,Hadley,7823919273,02-06-2007,Connecticut
15 WM_T83,Harper,7391027349,08-07-1999,Carolina
16 WM_M03,Iris,9102638491,27-05-2001,Texas
17 WM_N32,Finley,8729196472,12-08-2003,Pennsylvania
18 WM_WQ0,Fiona,7201982219,09-09-2014,Washington
19 WM_Q91,Carny,8976509871,30-12-2003,Virginia
20 WM_P21,Eleanor,8954321378,24-11-2007,Carolina
HospitalManagement/src/[Link]
1
2 //public class InvalidPatientIdException{
3 //FILL THE CODE HERE
4 public class InvalidPatientIdException extends Exception{
5 public InvalidPatientIdException(String message){
6 super(message);
7 }
8 }
9
10
11
12
HospitalManagement/src/[Link]
1 public class Main {
2
3 public static void main(String[] args){
4
5 // CODE SKELETON - VALIDATION STARTS
6 // DO NOT CHANGE THIS CODE
7
8 new SkeletonValidator();
9 // CODE SKELETON - VALIDATION ENDS
10
11 // FILL THE CODE HERE
12
13 }
14
15 }
16
17
HospitalManagement/src/[Link]
1 //DO NOT ADD/EDIT THE CODE
2 public class Patient {
3
4 private String patientId;
5 private String patientName;
6 private String contactNumber;
7 private String dateOfVisit;
8 private String patientAddress;
9
10 //Setters and Getters
11
12 public String getPatientId() {
13 return patientId;
14 }
15 public void setPatientId(String patientId) {
16 [Link] = patientId;
17 }
18 public String getPatientName() {
19 return patientName;
20 }
21 public void setPatientName(String patientName) {
22 [Link] = patientName;
23 }
24 public String getContactNumber() {
25 return contactNumber;
26 }
27 public void setContactNumber(String contactNumber) {
28 [Link] = contactNumber;
29 }
30 public String getDateOfVisit() {
31 return dateOfVisit;
32 }
33 public void setDateOfVisit(String dateOfVisit) {
34 [Link] = dateOfVisit;
35 }
36 public String getPatientAddress() {
37 return patientAddress;
38 }
39 public void setPatientAddress(String patientAddress) {
40 [Link] = patientAddress;
41 }
42
43
44
45
46 }
47
HospitalManagement/src/[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7 import [Link].*;
8 import [Link];
9 import [Link];
10 import [Link];
11 import [Link];
12
13
14 public class PatientUtility {
15
16 public List <Patient> fetchPatient(String filePath) {
17
18
19 //FILL THE CODE HERE
20 List <Patient> patients =new ArrayList<>();
21 try{
22 File register =new File(filePath);
23 Scanner reader=new Scanner(register);
24 while([Link]()){
25 Patient p = new Patient();
26 String[] infos=[Link]().split(",");
27 try{
28 if(isValidPatientId(infos[0])){
29 [Link](infos[0]);
30 [Link](infos[1]);
31 [Link](infos[2]);
32 [Link](infos[3]);
33 [Link](infos[4]);
34 [Link](p);
35 }
36 }
37 catch(InvalidPatientIdException e1){
38 [Link]([Link]());
39 }
40 }
41 [Link]();
42 }
43 catch(FileNotFoundException e){}
44 return patients;
45
46 //return null;
47 }
48
49
50 public boolean isValidPatientId (String patientId)throws InvalidPatientIdException
51 {
52
53 //FILL THE CODE HERE
54 Pattern p =[Link]("WM_[A-Z][0-9]{2}$");
55 Matcher m=[Link](patientId);
56 boolean ne =[Link]();
57 if(!ne){
58 throw new InvalidPatientIdException(patientId+"is an Invalid Patient Id.");
59
60 }
61 //return inValid;
62 return ne;
63 }
64
65
66 public List<Patient> retrievePatientRecords_ByDateOfVisit(Stream<Patient> patientStream, String
fromDate, String toDate)
67 {
68 //FILL THE CODE HERE
69 SimpleDateFormat simpleDateFormat=new SimpleDateFormat("dd-MM-yyyy");
70 return patientStream
71 .filter((p)->{
72 try{
73 Date start=[Link](fromDate);
74 Date end= [Link](toDate);
75 Date current =[Link]([Link]());
76 return [Link](current)*[Link](end)>=0;
77 }
78 catch(ParseException e){}
79 return false;
80 }).collect([Link]());
81 // return null;
82 }
83
84
85
86 public Stream<Patient> retrievePatientRecords_ByAddress(Stream<Patient> patientStream, String
address)
87 {
88
89 //FILL THE CODE HERE
90 return [Link](p->[Link]([Link]()));
91 //return null;
92
93
94
95 }
96
97 }
98
HospitalManagement/src/[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6
7 /**
8 * @author TJ
9 *
10 * This class is used to verify if the Code Skeleton is intact and not modified by participants thereby ensuring
smooth auto evaluation
11 *
12 */
13 public class SkeletonValidator {
14
15 public SkeletonValidator() {
16
17
18 validateClassName("Patient");
19 validateClassName("PatientUtility");
20 validateClassName("InvalidPatientIdException");
21 validateMethodSignature(
22
"fetchPatient:[Link],isValidPatientId:boolean,retrievePatientRecords_ByDateOfVisit:[Link]
,retrievePatientRecords_ByAddress:[Link]",
23 "PatientUtility");
24
25 }
26
27 private static final Logger LOG = [Link]("SkeletonValidator");
28
29 protected final boolean validateClassName(String className) {
30
31 boolean iscorrect = false;
32 try {
33 [Link](className);
34 iscorrect = true;
35 [Link]("Class Name " + className + " is correct");
36
37 } catch (ClassNotFoundException e) {
38 [Link]([Link], "You have changed either the " + "class
name/package. Use the correct package "
39 + "and class name as provided in the skeleton");
40
41 } catch (Exception e) {
42 [Link]([Link],
43 "There is an error in validating the " + "Class Name.
Please manually verify that the "
44 + "Class name is same as
skeleton before uploading");
45 }
46 return iscorrect;
47
48 }
49
50 protected final void validateMethodSignature(String methodWithExcptn, String className) {
51 Class cls = null;
52 try {
53
54 String[] actualmethods = [Link](",");
55 boolean errorFlag = false;
56 String[] methodSignature;
57 String methodName = null;
58 String returnType = null;
59
60 for (String singleMethod : actualmethods) {
61 boolean foundMethod = false;
62 methodSignature = [Link](":");
63
64 methodName = methodSignature[0];
65 returnType = methodSignature[1];
66 cls = [Link](className);
67 Method[] methods = [Link]();
68 for (Method findMethod : methods) {
69 if ([Link]([Link]())) {
70 foundMethod = true;
71 if
(!([Link]().getName().equals(returnType))) {
72 errorFlag = true;
73 [Link]([Link], " You
have changed the " + "return type in '" + methodName
74 + "'
method. Please stick to the " + "skeleton provided");
75
76 } else {
77 [Link]("Method signature of "
+ methodName + " is valid");
78 }
79
80 }
81 }
82 if (!foundMethod) {
83 errorFlag = true;
84 [Link]([Link], " Unable to find the given
public method " + methodName
85 + ". Do not change the " + "given
public method name. " + "Verify it with the skeleton");
86 }
87
88 }
89 if (!errorFlag) {
90 [Link]("Method signature is valid");
91 }
92
93 } catch (Exception e) {
94 [Link]([Link],
95 " There is an error in validating the " + "method
structure. Please manually verify that the "
96 + "Method signature is same as
the skeleton before uploading");
97 }
98 }
99
100 }
Grade
Reviewed on Monday, 7 February 2022, 6:04 PM by Automatic grade
Grade 100 / 100
Assessment report
Assessment Completed Successfully
[+]Grading and Feedback
=========================================================================
6. Technology Fest
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
String collegeName
String eventName
double registrationFee
Requirements:
· To calculate the registration fee of the participant based on the event name.
int counter
EventManagement public void Calculate the registration
calculateRegistrationFee(List fee of the participant
<Participant> list) based on the event name.
If the event name doesn’t
exist, throw an
InvalidEventException
with an error message
“Event Name is invalid”.
EventManagement public void run() Calculate the number of
participants registered for
a particular event.
Increment the counter
attribute based on the
search.
Note: The class and methods should be declared as public and all the attributes should be
declared as private.
Create a class called Main with the main method and perform the tasks are given below:
· Get the event type to search to find the number of the participants registered for that
particular event.
· In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the remaining text represent the output.
· Ensure to provide the names for classes, attributes, and methods as specified in the
question description.
Sample Input/Output 1:
rinu/4/EEE/mnm/robocar
fina/3/EEE/psg/papertalk
rachel/4/civil/kcg/quiz
robocar
Sample Input/Output 2:
rinu/4/EEE/mnm/robocar
fina/3/EEE/psg/papertalk
rachel/4/civil/kcg/quiz
games
No participant found
Sample Input/Output 3:
vishal/4/mech/vjc/flyingrobo
vivek/3/mech/hdl/games
Automatic evaluation[+]
TechnologyFest/src/[Link]
1 import [Link];
2
3 public class EventManagement implements Runnable {
4 private List<Participant> TechList;
5 private String searchEvent;
6 private int counter=0;
7 public List<Participant>getTechList()
8 {
9 return TechList;
10
11 }
12 public void setTechList(List<Participant>techList)
13 {
14 TechList=techList;
15 }
16 public String getSearchEvent()
17 {
18 return searchEvent;
19 }
20 public void setSearchEvent(String searchEvent)
21 {
22 [Link]=searchEvent;
23 }
24 public int getCounter()
25 {
26 return counter;
27 }
28 public void setCounter(int counter)
29 {
30 [Link]=counter;
31 }
32 //FILL THE CODE HERE
33
34 public void calculateRegistrationFee(List<Participant> list) throws InvalidEventException
35
36 {
37 for(Participant p:list)
38 {
39 if([Link]().equalsIgnoreCase("robocar"))
40 {
41 [Link](1000);
42 }
43 else if([Link]().equalsIgnoreCase("papertalk")){
44 [Link](500);
45
46 }
47
48 else if([Link]().equalsIgnoreCase("quiz")){
49 [Link](300);
50 }
51 else if([Link]().equalsIgnoreCase("games")){
52 [Link](100);
53 }
54 else{
55 throw new InvalidEventException("Event Name is Invalid");
56 }
57 }
58 //FILL THE CODE HERE
59 setTechList(list);
60 }
61
62 public void run()
63 {
64 String str="robocarpapertalkquizgames";
65 if([Link]([Link]())){
66 for(Participant P:[Link]()){
67 if([Link]().equals([Link]())){
68 counter++;
69 }
70 }
71 }
72 setCounter(counter);
73
74 //FILL THE CODE HERE
75
76 }
77 }
78
TechnologyFest/src/[Link]
1 public class InvalidEventException extends Exception{
2 //FILL THE CODE HERE
3 public InvalidEventException(String str){
4 super(str);
5
6}
7
8}
9
TechnologyFest/src/[Link]
1
2 import [Link];
3 import [Link].*;
4 public class Main {
5 public static void main(String [] args)
6 {
7 // CODE SKELETON - VALIDATION STARTS
8 // DO NOT CHANGE THIS CODE
9
10 new SkeletonValidator();
11
12 // CODE SKELETON - VALIDATION ENDS
13
14 Scanner sc=new Scanner([Link]);
15 [Link]("Enter the number of entries");
16 int n=[Link]();
17 [Link]("Enter the Participant
Name/Yearofstudy/Department/CollegeName/EventName");
18 List<Participant> list=new ArrayList<Participant>();
19 String strlist[]=new String[n];
20 for(int i=0;i<n;i++)
21 {
22 strlist[i]=[Link]();
23 String a[]=strlist[i].split("/");
24 Participant pt=new Participant(a[0],a[1],a[2],a[3],a[4]);
25 [Link](pt);
26 }
27 EventManagement em=new EventManagement();
28 try {
29 [Link](list);
30 }
31 catch(InvalidEventException e)
32 {
33 [Link]();
34
35 }
36 [Link]("Print participant details");
37 for(Participant p:list)
38 {
39 [Link](p);
40 }
41 [Link]("Enter the event to search");
42 String srch=[Link]();
43 [Link](srch);
44 [Link]();
45 int count=[Link]();
46 if(count<=0){
47 [Link]("No participant found");
48
49 }
50 else{
51 [Link]("Number of participants for"+srch+"event is "+count); }
52 }
53 }
54
55
56
57
TechnologyFest/src/[Link]
1 public class Participant {
2 private String name;
3 private String yearofstudy;
4 private String department;
5 private String collegeName;
6 private String eventName;
7 private double registrationFee;
8
9 //5 argument Constructor
10 public Participant(String name, String yearofstudy, String department, String collegeName, String
eventName) {
11 super();
12 [Link] = name;
13 [Link] = yearofstudy;
14 [Link] = department;
15 [Link] = collegeName;
16 [Link] = eventName;
17 }
18
19 public String getName() {
20 return name;
21 }
22 public void setName(String name) {
23 [Link] = name;
24 }
25 public String getYearofstudy() {
26 return yearofstudy;
27 }
28 public void setYearofstudy(String yearofstudy) {
29 [Link] = yearofstudy;
30 }
31 public String getDepartment() {
32 return department;
33 }
34 public void setDepartment(String department) {
35 [Link] = department;
36 }
37 public String getCollegeName() {
38 return collegeName;
39 }
40 public void setCollegeName(String collegeName) {
41 [Link] = collegeName;
42 }
43 public String getEventName() {
44 return eventName;
45 }
46 public void setEventName(String eventName) {
47 [Link] = eventName;
48 }
49 public double getRegistrationFee() {
50 return registrationFee;
51 }
52 public void setRegistrationFee(double registrationFee) {
53 [Link] = registrationFee;
54 }
55
56 @Override
57 public String toString() {
58 return "Participant [name=" + name + ", yearofstudy=" + yearofstudy + ", department=" +
department
59 + ", collegeName=" + collegeName + ", eventName=" +
eventName + ", registrationFee=" + registrationFee
60 + "]";
61 }
62
63
64
65
66 }
67
TechnologyFest/src/[Link]
1
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7
8 /**
9 * @author TJ
10 *
11 * This class is used to verify if the Code Skeleton is intact and not modified by participants thereby ensuring
smooth auto evaluation
12 *
13 */
14 public class SkeletonValidator {
15
16 public SkeletonValidator() {
17
18 //classes
19 validateClassName("Main");
20 validateClassName("EventManagement");
21 validateClassName("Participant");
22 validateClassName("InvalidEventException");
23 //functional methods
24 validateMethodSignature(
25 "calculateRegistrationFee:void","EventManagement");
26 validateMethodSignature(
27 "run:void","EventManagement");
28
29 //setters and getters of HallHandler
30 validateMethodSignature(
31 "getTechList:List","EventManagement");
32 validateMethodSignature(
33 "setTechList:void","EventManagement");
34
35 validateMethodSignature(
36 "getCounter:int","EventManagement");
37 validateMethodSignature(
38 "setCounter:void","EventManagement");
39
40 validateMethodSignature(
41 "getSearchEvent:String","EventManagement");
42 validateMethodSignature(
43 "setSearchEvent:void","EventManagement");
44
45 //setters and getters of Hall
46 validateMethodSignature(
47 "getName:String","Participant");
48 validateMethodSignature(
49 "setName:void","Participant");
50
51 validateMethodSignature(
52 "getYearofstudy:String","Participant");
53 validateMethodSignature(
54 "setYearofstudy:void","Participant");
55
56 validateMethodSignature(
57 "getDepartment:String","Participant");
58 validateMethodSignature(
59 "setDepartment:void","Participant");
60
61 validateMethodSignature(
62 "getCollegeName:String","Participant");
63 validateMethodSignature(
64 "setCollegeName:void","Participant");
65
66 validateMethodSignature(
67 "getEventName:String","Participant");
68 validateMethodSignature(
69 "setEventName:void","Participant");
70
71 validateMethodSignature(
72 "getRegistrationFee:double","Participant");
73 validateMethodSignature(
74 "setRegistrationFee:void","Participant");
75
76 }
77
78 private static final Logger LOG = [Link]("SkeletonValidator");
79
80 protected final boolean validateClassName(String className) {
81
82 boolean iscorrect = false;
83 try {
84 [Link](className);
85 iscorrect = true;
86 [Link]("Class Name " + className + " is correct");
87
88 } catch (ClassNotFoundException e) {
89 [Link]([Link], "You have changed either the " + "class
name/package. Use the correct package "
90 + "and class name as provided in the skeleton");
91
92 } catch (Exception e) {
93 [Link]([Link],
94 "There is an error in validating the " + "Class Name.
Please manually verify that the "
95 + "Class name is same as
skeleton before uploading");
96 }
97 return iscorrect;
98
99 }
100
101 protected final void validateMethodSignature(String methodWithExcptn, String className) {
102 Class cls = null;
103 try {
104
105 String[] actualmethods = [Link](",");
106 boolean errorFlag = false;
107 String[] methodSignature;
108 String methodName = null;
109 String returnType = null;
110
111 for (String singleMethod : actualmethods) {
112 boolean foundMethod = false;
113 methodSignature = [Link](":");
114
115 methodName = methodSignature[0];
116 returnType = methodSignature[1];
117 cls = [Link](className);
118 Method[] methods = [Link]();
119 for (Method findMethod : methods) {
120 if ([Link]([Link]())) {
121 foundMethod = true;
122 if
(!([Link]().getName().contains(returnType))) {
123 errorFlag = true;
124 [Link]([Link], " You
have changed the " + "return type in '" + methodName
125 + "'
method. Please stick to the " + "skeleton provided");
126
127 } else {
128 [Link]("Method signature of "
+ methodName + " is valid");
129 }
130
131 }
132 }
133 if (!foundMethod) {
134 errorFlag = true;
135 [Link]([Link], " Unable to find the given
public method " + methodName
136 + ". Do not change the " + "given
public method name. " + "Verify it with the skeleton");
137 }
138
139 }
140 if (!errorFlag) {
141 [Link]("Method signature is valid");
142 }
143
144 } catch (Exception e) {
145 [Link]([Link],
146 " There is an error in validating the " + "method
structure. Please manually verify that the "
147 + "Method signature is same as
the skeleton before uploading");
148 }
149 }
150
151 }
Grade
Reviewed on Monday, 7 February 2022, 6:34 PM by Automatic grade
Grade 74 / 100
Assessment report
Fail 1 -- test4CheckTheOutput::
$Expected output:"[Print participant details
ParticipantName=Weni
Yearofstudy=3
Department=civil
CollegeName=vjc
EventName=robocar
RegistrationFee=1000.0
ParticipantName=gina
Yearofstudy=2
Department=mech
CollegeName=vjc
EventName=quiz
RegistrationFee=300.0
ParticipantName=jos
Yearofstudy=4
Department=ece
CollegeName=vjec
EventName=games
RegistrationFee=100.0
ParticipantName=fida
Yearofstudy=1
Department=eee
CollegeName=vjec
EventName=papertalk
RegistrationFee=500.0
Enter the event to search
Number of participants for PAPERTALK event is 1]" Actual output:"[Enter the number of
entries
Enter the Participant Name/Yearofstudy/Department/CollegeName/EventName
Print participant details
Participant [name=Weni
yearofstudy=3
department=civil
collegeName=vjc
eventName=robocar
registrationFee=1000.0]
Participant [name=gina
yearofstudy=2
department=mech
collegeName=vjc
eventName=quiz
registrationFee=300.0]
Participant [name=jos
yearofstudy=4
department=ece
collegeName=vjec
eventName=games
registrationFee=100.0]
Participant [name=fida
yearofstudy=1
department=eee
collegeName=vjec
eventName=papertalk
registrationFee=500.0]
Enter the event to search
No participant found]"$
Check your code with the input :Weni/3/civil/vjc/robocar
gina/2/mech/vjc/quiz
jos/4/ece/vjec/games
fida/1/eee/vjec/papertalk
Fail 2 -- test6CheckTheOutputfor_NCount::
$Expected output:"[Print participant details
ParticipantName=philip
Yearofstudy=4
Department=eee
CollegeName=mvc
EventName=robocar
RegistrationFee=1000.0
ParticipantName=susan
Yearofstudy=4
Department=eee
CollegeName=mvc
EventName=robocar
RegistrationFee=1000.0
ParticipantName=vivek
Yearofstudy=3
Department=civil
CollegeName=mvc
EventName=quiz
RegistrationFee=300.0
ParticipantName=vishal
Yearofstudy=3
Department=civil
CollegeName=mvc
EventName=papertalk
RegistrationFee=500.0
Enter the event to search
Number of participants for ROBOCAR event is 2]" Actual output:"[Enter the number of
entries
Enter the Participant Name/Yearofstudy/Department/CollegeName/EventName
Print participant details
Participant [name=philip
yearofstudy=4
department=eee
collegeName=mvc
eventName=robocar
registrationFee=1000.0]
Participant [name=susan
yearofstudy=4
department=eee
collegeName=mvc
eventName=robocar
registrationFee=1000.0]
Participant [name=vivek
yearofstudy=3
department=civil
collegeName=mvc
eventName=quiz
registrationFee=300.0]
Participant [name=vishal
yearofstudy=3
department=civil
collegeName=mvc
eventName=papertalk
registrationFee=500.0]
Enter the event to search
No participant found]"$
Check your code with the input :philip/4/eee/mvc/robocar
susan/4/eee/mvc/robocar
vivek/3/civil/mvc/quiz
vishal/3/civil/mvc/papertalk
robocar
Obtained Pass Percentage. Still few testcases failed . Kindly revisit the Solution
[+]Grading and Feedback
Powered by
====================================================================
ZeeZee Bank
[Link]
public class Account {
private long accountNumber;
private double balanceAmount;
return false;
}
}
[Link]
import [Link];
import [Link];
if (!isWithdrawn) {
[Link]("Insufficient balance");
}
Numerology number
[Link]
import [Link];
return sum;
}
while ([Link]() != 1) {
string = [Link](getSum([Link](string)));
}
return [Link](string);
}
return oddCount;
}
return evenCount;
}
[Link]("Sum of digits");
[Link](getSum(num));
[Link]("Numerology number");
[Link](getNumerology(num));
if ([Link](ch)) {
int sub = (int) ch - 7;
[Link](ch);
} else if ([Link](ch)) {
[Link](ch);
}
}
if (flag) {
[Link]("Decrypted text:");
[Link]([Link]());
} else {
[Link]("No hidden message");
}
}
}
[Link]
public class CurrentAccount extends Account implements MaintenanceCharge {
public CurrentAccount(String accountNumber, String customerName, double balance) {
super(accountNumber, customerName, balance);
}
@Override
public float calculateMaintenanceCharge(float noOfYears) {
return (100.0f + noOfYears) + 200.0f;
}
}
[Link]
public interface MaintenanceCharge {
float calculateMaintenanceCharge(float noOfYears);
}
[Link]
public class SavingsAccount extends Account implements MaintenanceCharge {
public SavingsAccount(String accountNumber, String customerName, double balance) {
super(accountNumber, customerName, balance);
}
@Override
public float calculateMaintenanceCharge(float noOfYears) {
return (50.0f * noOfYears) + 50.0f;
}
}
[Link]
import [Link];
import [Link];
switch (choice) {
case 1: {
SavingsAccount savingsAccount = new SavingsAccount(accountNumber,
customerName, balance);
[Link]("Maintenance Charge for Savings Account is Rs " +
[Link]([Link](noOfYears)));
break;
}
case 2: {
CurrentAccount currentAccount = new CurrentAccount(accountNumber,
customerName, balance);
[Link]("Maintenance Charge for Current Account is Rs " +
[Link]([Link](noOfYears)));
}
}
}
}
Batting Average
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
while (flag) {
[Link]("1. Add Runs Scored");
[Link]("2. Calculate average runs scored");
[Link]("3. Exit");
[Link]("Enter your choice");
int choice = [Link]();
switch (choice) {
case 1: {
[Link]("Enter the runs scored");
int score = [Link]();
[Link](score);
break;
}
case 2: {
[Link]("Average runs secured");
[Link]([Link]());
break;
}
case 3: {
[Link]("Thank you for use the application");
flag = false;
break;
}
}
}
}
}
[Link]
package [Link];
import [Link];
Grade Calculation
[Link]
import [Link];
@Override
public void run() {
int totalMarks = 0;
@Override
public String toString() {
return id;
}
@Override
public int compareTo(Employee employee) {
return [Link]([Link]());
}
}
try {
LocalDate joiningDate = [Link](joiningDateStr, dateTimeFormatter);
Employee employee = new Employee(id, joiningDate);
[Link](now);
[Link](employee);
} catch (Exception ignore) {
[Link]("Invalid date format");
[Link](0);
}
});
List<Employee> filteredEmployees =
[Link]().filter(Employee::getIsEligible).collect([Link]());
if ([Link]()) {
[Link]("No one is eligible");
} else {
[Link](filteredEmployees);
[Link]([Link]::println);
}
}
}
[Link]
import [Link];
if (idOdd().checkNumber(num)) {
[Link](num + " is odd");
} else {
[Link](num + " is not odd");
}
}
}
[Link]
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class DB {
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
public static Connection getConnection() throws ClassNotFoundException,
SQLException {
try{
[Link]
import [Link].*;
import [Link].*;
public class FlightManagementSystem{
public ArrayList<Flight> viewFlightsBySourceDestination(String source, String destination){
DB db=new DB();
ArrayList<Flight> list=new ArrayList<Flight>();
try{
int f=0;
Connection con=[Link]();
Statement st=[Link]();
String sql= "select * from Flight where source= '"+source+"' and destination=
'"+destination+"'";
ResultSet rs=[Link](sql);
while([Link]()){
f=1;
Flight x=new Flight([Link](1), [Link](2),[Link](3), [Link](4),
[Link](5));
[Link](x);
}
[Link]();
if(f==1)
return list;
else
return null;
}
catch(SQLException e){
[Link]("SQL Error. Contact Administrator.");
return null;
}
catch(Exception e){
[Link]("Exception. Contact Administrator.");
return null;
}
}
}
[Link]
Perform Calculation
import [Link];
int a = [Link]();
int b= [Link]();
[Link]("The difference is
"+Perform_subtraction.performCalculation(a,b));
return Perform_calculation;
}
return Perform_calculation;
return Perform_calculation;
float c = (float)a;
float d = (float)b;
return (c/d);
};
return Perform_calculation;
GD HOSPITAL
Payment Inheritance
[Link]
public class Bill {
String message = "Payment not done and your due amount is "+[Link]();
if(obj instanceof Cheque ) {
if([Link]())
if([Link]())
if([Link]())
return message;
[Link]
public class Cash extends Payment{
[Link] = cashAmount;
@Override
[Link]
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link] = dateOfIssue;
@Override
try {
Date issueDate = new SimpleDateFormat("dd-MM-yyyy").parse(date);
setDateOfIssue(issueDate);
}
catch (ParseException e) {
[Link]();
}
}
}
[Link]
public class Credit extends Payment {
return creditCardNo;
[Link] = creditCardNo;
return cardType;
[Link] = cardType;
return creditCardAmount;
@Override
int tax = 0;
switch(cardType) {
case "silver":
setCreditCardAmount(10000);
setCreditCardAmount(getCreditCardAmount()-tax);
isDeducted = true;
break;
case "gold":
setCreditCardAmount(50000);
setCreditCardAmount(getCreditCardAmount()-tax);
isDeducted = true;
}
break;
case "platinum":
setCreditCardAmount(100000);
setCreditCardAmount(getCreditCardAmount()-tax);
isDeducted = true;
break;
return isDeducted;
[Link]
import [Link];
switch (mode) {
case "cash":
[Link](cashAmount);
[Link](dueAmount);
[Link]([Link](cash));
break;
case "cheque":
[Link](chequeAmount);
[Link](number);
[Link](date);
[Link](dueAmount);
[Link]([Link](cheque));
break;
case "credit":
[Link](cardType);
[Link](creditNumber);
[Link](dueAmount);
[Link]([Link](credit));
default:
break;
[Link]();
[Link]
public class Payment {
return dueAmount;
}
[Link] = dueAmount;
return false;
HUNGER EATS
package [Link];
import [Link].*;
import [Link];
public class Order{
private double discountPercentage;
private List<FoodProduct> foodList=new ArrayList<FoodProduct>();
}
// [Link](bill);
// [Link](dis);
bill=bill-((bill*discountPercentage)/100);
return bill;
}
}
package [Link];
import [Link];
import [Link];
import [Link];
for(int i=0;i<itemno;i++)
{
FoodProduct fd=new FoodProduct();
[Link]("Enter the item id");
[Link]([Link]());
[Link]("Enter the item name");
[Link]([Link]());
[Link]("Enter the cost per unit");
[Link]([Link]());
[Link]("Enter the quantity");
[Link]([Link]());
[Link](fd);
}
}
package [Link];
Singapore
import [Link].*;
public class tourism {
static String name;
static String place;
static int days;
static int tickets;
static double price = 0.00;
static double total = 0.00;
public static void main(String[] args){
Scanner in = new Scanner([Link]);
[Link]("Enter the passenger name");
name = [Link]();
[Link]("Enter the place name");
place=[Link]();
if([Link]("beach")
||[Link]("pilgrimage")||[Link]("heritage")||[Link]
reCase("Hills")||[Link]("palls")||[Link]("adventure")){
[Link]("Enter the number of days");
days = [Link]();
if(days>0){
[Link]("Enter the number of Tickets");
tickets = [Link]();
if(tickets>0){
if([Link]("beach")){
price = tickets*270;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("prilgrimage")){
price = tickets*350;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("heritage")){
price = tickets*430;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("hills")){
price = tickets*780;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("palls")){
price = tickets*1200;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else {
price = tickets*4500;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
}
else{
[Link](tickets+" is an Invalid no. of tickets");
}
}
else{
[Link](days+" is an Invalid no. of days");
}
}
else {
[Link](place+" is an Invalid place");
}
}
}
Prime no ending
import [Link].*;
public class Main
{
public static void main (String[] args) {
int flag=0, k=0, z=0;
Scanner sc =new Scanner([Link] );
[Link]("Enter the first number");
int f=[Link]();
[Link]("Enter the last number");
int l=[Link]();
for(int i=f; i<=l; i++)
{
for(int j=2; j<i; j++)// this loop increments flag if i is divisible by j
{
if(i%j==0)
{
flag++;
}
}
if(i==l && (flag!=0 || i%10!=1))//when last number is not a prime
{
while(z==0)
{
for(int a=2; a<i; a++)
{
if(i%a==0)
{
flag++;
}
}
if(i%10==1 && flag==0)
{
[Link](","+i);
z++;
}
flag=0;
i++;
}
}
if(i%10==1 && flag==0)//to check for last digit 1 and prime
{
if(k==0)
{
[Link](i);
k++;
}
else
{
[Link](","+i);
}
}
flag=0;
}
}
}
Query Set
public class Query {
import [Link];
public class TestApplication {
public static void main(String[] args) {
Query query = new Query();
Scanner sc = new Scanner([Link]);
[Link] primary = [Link] DataSet();
[Link] secondary = [Link] DataSet();
[Link]("Enter the Details of primary data set");
[Link]("Enter the theatre id");
String theatreid = [Link]();
[Link](theatreid);
[Link]();
[Link]("Enter the theatre name");
String theatrename = [Link]();
[Link](theatrename);
[Link]();
[Link]("Enter the location");
String location = [Link]();
[Link](location);
[Link]();
[Link]("Entrer the no of screens");
int screens = [Link]();
[Link](screens);
[Link]("Ente the ticket cost");
double cost = [Link]();
[Link](cost);
[Link]("ENter the details of secondary data set");
[Link]("Enter the theatre id");
theatreid = [Link]();
[Link](theatreid);
[Link]();
[Link]("Enter the theatre name");
theatrename = [Link]();
[Link](theatrename);
[Link]();
[Link]("Enter the location");
location = [Link]();
[Link](location);
[Link]();
[Link]("Entrer the no of screens");
screens = [Link]();
[Link](screens);
[Link]("Ente the ticket cost");
cost = [Link]();
[Link](cost);
[Link]("Enter the query id");
String queryid = [Link]();
[Link](queryid);
[Link]();
[Link]("Enter the query category");
String querycategory = [Link]();
[Link](querycategory);
[Link]();
[Link](primary);
[Link](secondary);
[Link](query);
}
}
Extract book
import [Link];
class ExtractBook {
switch (code) {
case 101:
return "Accounting";
case 102:
return "Economics";
case 103:
return "Engineering";
}
try {
int dCode = extractDepartmentCode(str);
String dString = extractDepartmentName(dCode);
int year = extractDate(str);
int pages = extractNumberOfPages(str);
String bookId = extractBookId(str);
} catch (Error e) {
[Link]([Link]());
}
}
Fixed deposit
import [Link].*;
class FDScheme {
Annual Salary
import [Link].*;
public class Main
{
public static void main(String[] args)throws IOException
{
// Scanner sc=new Scanner([Link]);
//Fill the code
BufferedReader br=new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter the Employee Name");
String name=[Link]();
[Link]("Enter percentage of salary");
double percent=[Link]([Link]());
if(percent>0&&percent<20)
{
[Link]("Enter the Year of Experience");
int time=[Link]([Link]());
if(time>0&&time<15)
{
double permonth=12000+(2000*(time));
double dayshift=permonth*6;
double nightshift=(((permonth*percent)/100)+permonth)*6;
double annualIncome=dayshift+nightshift;
}
else{
[Link]((int)time+" is an invalid year of experience");}
}
else
[Link]((int)percent+" is an invalid percentage");
}
}
Amity Passenger
import [Link].*;
public class PassengerAmenity {
if(no>0)
{
String name[]=new String[no];
String seat[]=new String[no];
String arr[]=new String[no];
for(int i=0;i<no;i++)
{
[Link]("Enter the name of the passenger "+(i+1));
String str=[Link]();
name[i]=[Link]();
int r=[Link](seat[i].substring(1,seat[i].length()));
else
{
[Link](r+" is invalid seat number");
break;
}
}
else
{
[Link](seat[i].charAt(0)+" is invalid coach");
break;
}
arr[i]=name[i]+" "+seat[i];
}
if(count==[Link])
{
[Link](seat);
for(int i=[Link]-1;i>=0;i--)
{
for(int j=0;j<[Link];j++)
{
if(arr[j].contains(seat[i]))
{
[Link](arr[j]);
}
}
}
}
}
else
{
[Link](no+" is invalid input");
}
}
Club Member
import [Link];
[Link]=(double) 50000.0;
}
else if(!(memberType=="Premium"))
{
[Link]=(double) 75000.0;
}
[Link]("Member Id is "+[Link]);
[Link]("Member Name is "+[Link]);
[Link]("Member Type is "+[Link]);
[Link]("Membership Fees is "+[Link]);
}
}
1. AirVoice - Registration
SmartBuy is a leading mobile shop in the town. After buying a product, the customer needs to
provide a few personal details for the invoice to be generated.
You being their software consultant have been approached to develop software to retrieve the
personal details of the customers, which will help them to generate the invoice faster.
String emailId
int age
Get the details as shown in the sample input and assign the value for its attributes using the
setters.
Display the details as shown in the sample output using the getters method.
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes and methods as specified in the question.
Sample Input 1:
john
9874561230
john@[Link]
32
Sample Output 1:
Name:john
ContactNumber:9874561230
EmailId:john@[Link]
Age:32
Automatic evaluation[+]
[Link]
[Link]
1 import [Link];
2
3 public class Main {
4
5 public static void main(String[] args) {
6 // TODO Auto-generated method stub
7 Scanner sc=new Scanner([Link]);
8 Customer c=new Customer();
9 [Link]("Enter the Name:");
10 String name=([Link]());
11 [Link]("Enter the ContactNumber:");
12 long no=[Link]();
13 [Link]();
14 [Link]("Enter the EmailId:");
15 String mail=[Link]();
16
17 [Link]("Enter the Age:");
18 int age=[Link]();
19 [Link](name);
20 [Link](no);
21 [Link](mail);
22 [Link](age);
23 [Link]("Name:"+[Link]());
24 [Link]("ContactNumber:"+[Link]());
25 [Link]("EmailId:"+[Link]());
26 [Link]("Age:"+[Link]());
27
28
29
30 }
31
32 }
Grade
Reviewed on Monday, 7 February 2022, 4:45 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
=================================================================================
2. Payment - Inheritance
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
Payment Status
Roy is a wholesale cloth dealer who sells cloth material to the local tailors on monthly
installments. At the end of each month, he collects the installment amount from all his customers.
Some of his customers pay by Cheque, some pay by Cash and some by Credit Card. He wants
to automate this payment process.
The application needs to verify the payment process and display the status report of payment by
getting the inputs like due amount, payment mode and data specific to the payment mode from
the user and calculate the balance amount.
Note:
Date
dateOfIssue
Make payment Cheque public boolean This is an overridden method
for EMI payAmount() of the parent class. It should
amount return true if the cheque is
valid and the amount is valid.
Else return false.
Note:
int
creditCardAmount
Make Credit public boolean This is an overridden method of
payment for payAmount() the parent class. It should deduct
EMI amount the dueAmount and service tax
from the creditCardAmount and
return true if the credit card
payment was done successfully.
Else return false.
Note:
· The payment can be done if the credit card amount is greater than or equal to the sum of
due amount and service tax. Else payment cannot be made.
· The cardType can be “silver” or “gold” or “platinum”. Set the creditCardAmount based on
the cardType.
· The boolean payAmount() method should deduct the due amount and the service tax
amount from a credit card. If the creditCardAmount is less than the dueAmount+serviceTax, then
the payment cannot be made.
· The balance in credit card amount after a successful payment should be updated in the
creditCardAmount by deducting the sum of dueAmount and serviceTax from creditCardAmount
itself.
Note:
· If the payment is successful, processPayment method should return a message “Payment
done successfully via cash” or “Payment done successfully via cheque” or “Payment done
successfully via creditcard. Remaining amount in your <<cardType>> card is <<balance in
CreditCardAmount>>”
· If the payment is a failure, then return a message “Payment not done and your due amount
is <<dueAmount>>”
Create a public class Main with the main method to test the application.
Note:
· In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the rest of the text represents the output.
· Ensure to provide the names for classes, attributes and methods as specified in the
question.
Sample Input 1:
3000
Enter the mode of payment(cheque/cash/credit):
cash
Enter the cash amount:
2000
Sample Output 1:
Sample Input 2:
3000
Enter the mode of payment(cheque/cash/credit):
cash
Enter the cash amount:
3000
Sample Output 2:
Sample Input 3:
3000
Enter the mode of payment(cheque/cash/credit):
cheque
Enter the cheque number:
123
Enter the cheque amount:
3000
Enter the date of issue:
21-08-2019
Sample Output 3:
Sample Input 4:
3000
Enter the mode of payment(cheque/cash/credit):
credit
Enter the credit card number:
234
Enter the card type(silver,gold,platinum):
silver
Sample Output 4:
Payment done successfully via credit card. Remaining amount in your silver card is 6940
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 public class Main {
6
7 public static void main(String[] args) {
8
9 Scanner sc=new Scanner([Link]);
10 [Link]("Enter the due amount:");
11 int dueAmount=[Link]();
12
13 [Link]("Enter the mode of payment(cheque/cash/credit):");
14 String mode=[Link]();
15 Bill b = new Bill();
16 if([Link]("cheque"))
17 {
18 [Link]("enter the cheque number:");
19 String chequeNumber=[Link]();
20 [Link]("enter the cheque amount:");
21 int chequeAmount=[Link]();
22 [Link]("enter the date of issue:");
23 String date=[Link]();
24 SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
25 Date dateOfIssue=null;
26 try
27 {
28 dateOfIssue = [Link](date);
29 }
30 catch (ParseException e)
31 {
32
33 }
34 Cheque cheque= new Cheque();
35 [Link](chequeNumber);
36 [Link](chequeAmount);
37 [Link](dateOfIssue);
38 [Link](dueAmount);
39 [Link]([Link](cheque));
40 }
41 else if([Link]("cash"))
42 {
43 [Link]("enter the cash amount:");
44 int CashAmount=[Link]();
45 Cash cash=new Cash();
46 [Link](CashAmount);
47 [Link](dueAmount);
48 [Link]([Link](cash));
49 }
50 else if([Link]("credit"))
51 {
52 [Link]("enter the credit card number:");
53 int creditCardNumber=[Link]();
54 [Link]("enter the card type:");
55 String cardType=[Link]();
56
57 Credit credit=new Credit();
58 [Link](creditCardNumber);
59 [Link](cardType);
60 [Link](dueAmount);
61 [Link]([Link](credit));
62 }
63 }
64 }
[Link]
1 public class Payment {
2 private int dueAmount;
3
4 public boolean payAmount()
5 {
6 if(dueAmount == 0)
7 return true;
8 else
9 return false;
10 }
11
12 public int getDueAmount() {
13 return dueAmount;
14 }
15
16 public void setDueAmount(int dueAmount) {
17 [Link] = dueAmount;
18 }
19 }
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 public class Cheque extends Payment {
5 String chequeNo;
6 int chequeAmount;
7 Date dateOfIssue;
8 public String getChequeNo() {
9 return chequeNo;
10 }
11 public void setChequeNo(String chequeNo) {
12 [Link] = chequeNo;
13 }
14 public int getChequeAmount() {
15 return chequeAmount;
16 }
17 public void setChequeAmount(int chequeAmount) {
18 [Link] = chequeAmount;
19 }
20 public Date getDateOfIssue() {
21 return dateOfIssue;
22 }
23 public void setDateOfIssue(Date dateOfIssue) {
24 [Link] = dateOfIssue;
25 }
26
27 @Override
28 public boolean payAmount()
29 {
30 SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
31 Date today = new Date();
32 try
33 {
34 today = [Link]("01-01-2020");
35 }
36 catch (ParseException e)
37 {
38 return false;
39 }
40 long diff = [Link]()-[Link]();
41 int day = (int) [Link](diff/(1000*60*60*24));
42 int month = day/30;
43 if(month <=6)
44 {
45
46 if(chequeAmount>=getDueAmount())
47 {
48 return true;
49 }
50 else
51 return false;
52
53 }
54 else
55 return false;
56 }
57
58
59 }
[Link]
1 public class Cash extends Payment {
2 int cashAmount;
3
4 public int getCashAmount() {
5 return cashAmount;
6 }
7
8 public void setCashAmount(int cashAmount) {
9 [Link] = cashAmount;
10 }
11
12 @Override
13 public boolean payAmount()
14 {
15 if(cashAmount>=getDueAmount())
16 return true;
17 else
18 return false;
19 }
20
21
22 }
[Link]
1 public class Credit extends Payment {
2 int creditCardNo;
3 String cardType;
4 int creditCardAmount;
5 public int getCreditCardNo() {
6 return creditCardNo;
7 }
8 public void setCreditCardNo(int creditCardNo) {
9 [Link] = creditCardNo;
10 }
11 public String getCardType() {
12 return cardType;
13 }
14 public void setCardType(String cardType) {
15 [Link] = cardType;
16 }
17 public int getCreditCardAmount() {
18 return creditCardAmount;
19 }
20 public void setCreditCardAmount(int creditCardAmount) {
21 [Link] = creditCardAmount;
22 }
23
24
25 @Override
26 public boolean payAmount()
27 {
28 int netAmount = 0;
29 if([Link]("silver"))
30 {
31 netAmount = (int) (getDueAmount()*1.02);
32 creditCardAmount = 10000;
33 }
34 else if([Link]("gold"))
35 {
36 netAmount = (int) (getDueAmount()*1.05);
37 creditCardAmount = 50000;
38 }
39 else if([Link]("platinum"))
40 {
41 netAmount = (int) (int) (getDueAmount()*1.1);
42 creditCardAmount = 100000;
43 }
44
45 if(creditCardAmount>=netAmount)
46 {
47 creditCardAmount = creditCardAmount - netAmount;
48 return true;
49 }
50 else
51 return false;
52 }
53
54
55 }
[Link]
1 public class Bill {
2 public String processPayment(Payment obj)
3{
4 String res="";
5 if(obj instanceof Cheque)
6 {
7 if([Link]())
8 res = "Payment done successfully via cheque";
9 else
10 res = "Payment not done and your due amount is
"+[Link]();
11 }
12 else if(obj instanceof Cash)
13 {
14 if([Link]())
15 res = "Payment done successfully via cash";
16 else
17 res = "Payment not done and your due amount is
"+[Link]();
18 }
19 else if(obj instanceof Credit)
20 {
21 Credit c = (Credit) obj;
22 if([Link]())
23 res = "Payment done successfully via credit card. Remaining
amount in your "+[Link]()+" card is "+[Link]();
24 else
25 res = "Payment not done and your due amount is
"+[Link]();
26 }
27 return res;
28 }
29 }
Grade
Reviewed on Wednesday, 1 December 2021, 10:08 PM by Automatic grade
Grade 100 / 100
Assessment report
TEST CASE PASSED
[+]Grading and Feedback
[Link] Progress
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Andrews taught exponential multiplication to his daughter and gave her two inputs.
Assume, the first input as M and the second input as N. He asked her to find the sequential
power of M until N times. For Instance, consider M as 3 and N as 5. Therefore, 5 times the power
is incremented gradually from 1 to 5 such that, 3^1=3, 3^2=9,3^3=27,3^4=81,3^5=243. The input
numbers should be greater than zero Else print “<Input> is an invalid”. The first Input must be
less than the second Input, Else print "<first input> is not less than <second input>".
Write a Java program to implement this process programmatically and display the output in
sequential order. ( 3^3 means 3*3*3 ).
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Sample Input 1:
3
5
Sample Output 1:
3 9 27 81 243
Explanation: Assume the first input as 3 and second input as 5. The output is to be displayed
are based on the sequential power incrementation. i.e., 3(3) 9(3*3) 27(3*3*3) 81(3*3*3*3)
243(3*3*3*3*3)
Sample Input 2:
-3
Sample Output 2:
-3 is an invalid
Sample Input 3:
3
0
Sample Output 3:
0 is an invalid
Sample Input 4:
4
2
Sample Output 4:
4 is not less than 2
Automatic evaluation[+]
[Link]
1 import [Link].*;
2 public class Main
3{
4 public static void main(String[] args)
5 {
6 Scanner sc=new Scanner([Link]);
7 //Fill the code
8 int m=[Link]();
9 if(m<=0){
10 [Link](""+m+" is an invalid");
11 return;
12 }
13 int n=[Link]();
14 if(n<=0){
15 [Link](""+n+" is an invalid");
16 return;
17 }
18 if(m>=n){
19 [Link](""+m+" is not less than "+n);
20 return;
21 }
22 for(int i=1;i<=n;i++){
23 [Link]((int)[Link](m,i)+"");
24 }
25 }
26 }
Grade
Reviewed on Monday, 7 February 2022, 4:46 PM by Automatic grade
Grade 100 / 100
Assessment report
TEST CASE PASSED
[+]Grading and Feedback
4. ZeeZee bank
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
ZeeZee is a leading private sector bank. In the last Annual meeting, they decided to give their
customer a 24/7 banking facility. As an initiative, the bank outlined to develop a stand-alone
device that would offer deposit and withdrawal of money to the customers anytime.
You being their software consultant have been approached to develop software to implement
the functionality of deposit and withdrawal anytime.
As per this requirement, the customer should be able to deposit money into his account at any
time and the deposited amount should reflect in his account balance.
Deposit amount to Account public void deposit(double This method takes the
an account depositAmt) amount to be deposited as
an argument
As per this requirement, the customer should be able to withdraw money from his account
anytime he wants. The amount to be withdrawn should be less than or equal to the balance in
the account. After the withdrawal, the account should reflect the balance amount
In the Main class, Get the details as shown in the sample input.
Create an object for the Account class and invoke the deposit method to deposit the amount
and withdraw method to withdraw the amount from the account.
Note:
If the balance amount is insufficient then display the message as shown in the Sample Input /
Output.
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes, and methods as specified in the question.
Sample Input/Output 1:
1234567890
15000
1500
500
Sample Input/Output 2:
1234567890
15000
Enter the amount to be deposited:
1500
18500
Insufficient balance
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4
5
6 public class Main{
7 static Account ac=new Account(0, 0);
8 public static void main (String[] args) {
9 Scanner sc=new Scanner([Link]);
10 [Link]("Enter the account number:");
11 [Link]([Link]());
12 [Link]("Enter the available amount in the account:");
13 [Link]([Link]());
14 [Link]("Enter the amount to be deposited:");
15 [Link]([Link]());
16 [Link]("Available balance is:%.2f",[Link]());
17 [Link]();
18 [Link]("Enter the amount to be withdrawn:");
19 [Link]([Link]());
20 [Link]("Available balance is:%.2f",[Link]());
21 //Fill the code
22 }
23 }
24
25
26
[Link]
1
2 public class Account {
3 long accountNumber;
4 double balanceAmount;
5
6
7 public Account(long accno, double bal){
8 super();
9 [Link]=accno;
10 [Link]=bal;
11 }
12 public long getAccountNumber(){
13 return accountNumber;
14 }
15 public void setAccountNumber(long accno){
16 [Link]=accno;
17 }
18 public double getBalanceAmount(){
19 return balanceAmount;
20 }
21 public void setBalanceAmount(double bal) {
22 [Link]=bal;
23 }
24 public void deposit(double depositAmt){
25 float total=(float)(balanceAmount+depositAmt);
26 balanceAmount=total;
27 }
28 public boolean withdraw(double withdrawAmt){
29 float total;
30 if(withdrawAmt>balanceAmount){
31 [Link]("Insufficient balance");
32
33 return false;
34 }else{
35 total=(float)(balanceAmount-withdrawAmt);
36 setBalanceAmount(total);
37 return true;
38 }
39 }
40 }
Grade
Reviewed on Monday, 7 February 2022, 4:47 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
5. Reverse a word
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Reverse a word
Rita and Brigitha want to play a game. That game is to check the first letter of each word in a
given sentence (Case Insensitive). If it is equal, then reverse the last word and concatenate the
first word. Else reverse the first word and concatenate the last word. Create a Java application
and help them to play the game
Note:
● Sentence must contain at least 3 words else print "Invalid Sentence" and terminate the
program
● Each word must contain alphabet only else print "Invalid Word" and terminate the
program
● Check the first letter of each word in a given sentence (Case Insensitive). If it is equal,
then reverse the last word and concatenate the first word and print. Else reverse the first
word and concatenate the last word and print.
● Print the output without any space.
Sample Input 1:
Sample Output 1:
sllehsaesSea
Sample Input 2:
Sample Output 2:
maSdays
Sample Input 3:
Welcome home
Sample Output 3:
Invalid Sentence
Sample Input 4:
Friendly fire fighting fr@gs.
Sample Output 4:
Invalid Word
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link].*;
3 import [Link].*;
4 public class Main{
5 public static void main(String[] args){
6 String[] words;
7 Scanner read =new Scanner([Link]);
8 String sentence=[Link]();
9 words=[Link](" ");
10 if([Link]<3)
11 [Link]("Invalid Sentence");
12 else{
13 String a=words[0].substring(0,1);
14 String b=words[1].substring(0,1);
15 String c=words[2].substring(0,1);
16 if([Link](b)&&[Link](c))
17 {
18 StringBuilder k= new StringBuilder();
19 [Link](words[[Link]-1]);
20 k=[Link]();
21 [Link](words[0]);
22 [Link](k);
23 }
24 else{
25 StringBuilder k = new StringBuilder();
26 [Link](words[0]);
27 k=[Link]();
28 [Link](words[[Link]-1]);
29 [Link](k);
30 }
31 }
32 }
33 }
Grade
Reviewed on Monday, 7 February 2022, 5:12 PM by Automatic grade
Grade 90 / 100
Assessment report
Fail 1 -- test5_CheckForTheSentenceContainsOtherThanAlphabets::
$Expected output:"[Invalid Word]" Actual output:"[tahWme]"$
[+]Grading and Feedback
6. Dominion cinemas
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Dominion cinema is a famous theatre in the city. It has different types of seat tiers – Platinum,
Gold and Silver. So far the management was manually calculating the ticket cost for all their
customers which proved very hectic and time consuming. Going forward they want to calculate
ticket cost using their main computer. Assist them in calculating and retrieving the amount to be
paid by the Customer.
The application needs to calculate the ticket cost to be paid by the Customer according to the
seat tier.
Note:
Note:
Use a public class UserInterface with the main method to test the application. In the main
method call the validateTicketId() method, if the method returns true display the amount else
display "Provide valid Ticket Id".
Note:
● In the Sample Input / Output provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
● Ensure to follow the object oriented specifications provided in the question.
● Ensure to provide the names for classes, attributes and methods as specified in the
question.
● Adhere to the code template, if provided.
Sample Input 1:
Enter Ticket Id
SILVER490
Venkat
9012894578
Enter Email Id
venkat@[Link]
Avengers
8
Do you want AC or not
Sample Input 2:
Enter Ticket Id
ACN450
Kamal
9078561093
Enter Email Id
kamal@[Link]
Tangled
Automatic evaluation[+]
[Link]
1
2 public class BookAMovieTicket {
3
4 protected String ticketId;
5 protected String customerName;
6 protected long mobileNumber;
7 protected String emailId;
8 protected String movieName;
9
10 public String getTicketId() {
11 return ticketId;
12 }
13 public void setTicketId(String ticketId) {
14 [Link] = ticketId;
15 }
16 public String getCustomerName() {
17 return customerName;
18 }
19 public void setCustomerName(String customerName) {
20 [Link] = customerName;
21 }
22 public long getMobileNumber() {
23 return mobileNumber;
24 }
25 public void setMobileNumber(long mobileNumber) {
26 [Link] = mobileNumber;
27 }
28 public String getEmailId() {
29 return emailId;
30 }
31 public void setEmailId(String emailId) {
32 [Link] = emailId;
33 }
34 public String getMovieName() {
35 return movieName;
36 }
37 public void setMovieName(String movieName) {
38 [Link] = movieName;
39 }
40
41 public BookAMovieTicket(String ticketId, String customerName, long mobileNumber, String emailId,
String movieName) {
42 [Link] = ticketId;
43 [Link] = customerName;
44 [Link] = mobileNumber;
45 [Link] = emailId;
46 [Link] = movieName;
47
48 }
49
50
51
52 }
53
[Link]
1
2 public class GoldTicket extends BookAMovieTicket{
3 public GoldTicket(String ticketId,String customerName, long mobileNumber,
4 String emailId, String movieName){
5 super(ticketId, customerName, mobileNumber, emailId, movieName);
6 }
7
8 public boolean validateTicketId(){
9 int count=0;
10 if([Link]("GOLD"));
11 count++;
12 char[] cha=[Link]();
13 for(int i=4;i<7;i++){
14 if(cha[i]>='1'&& cha[i]<='9')
15 count++;
16 }
17 if(count==4)
18 return true;
19 else
20 return false;
21 }
22
23
24 // Include Constructor
25
26 public double calculateTicketCost(int numberOfTickets, String ACFacility){
27 double amount;
28 if([Link]("yes")){
29 amount=500*numberOfTickets;
30 }
31 else{
32 amount=350*numberOfTickets;
33 }
34
35 return amount;
36 }
37
38 }
[Link]
[Link]
1
2 public class SilverTicket extends BookAMovieTicket{
3 public SilverTicket(String ticketId, String customerName, long mobileNumber,
4 String emailId, String movieName){
5 super(ticketId, customerName, mobileNumber, emailId, movieName);
6 }
7
8 public boolean validateTicketId(){
9 int count=0;
10 if([Link]("SILVER"));
11 count++;
12 char[] cha=[Link]();
13 for(int i=6;i<9;i++){
14 if(cha[i]>='1'&& cha[i]<='9')
15 count++;
16 }
17 if(count==4)
18 return true;
19 else
20 return false;
21 }
22
23 // Include Constructor
24
25 public double calculateTicketCost(int numberOfTickets, String ACFacility){
26 double amount;
27 if([Link]("yes")){
28 amount=250*numberOfTickets;
29 }
30 else{
31 amount=100*numberOfTickets;
32 }
33
34 return amount;
35 }
36
37 }
38
[Link]
1 import [Link].*;
2
3 public class UserInterface {
4
5 public static void main(String[] args){
6 Scanner sc=new Scanner([Link]);
7 [Link]("Enter Ticket Id");
8 String tid=[Link]();
9 [Link]("Enter Customer name");
10 String cnm=[Link]();
11 [Link]("Enter Mobile number");
12 long mno=[Link]();
13 [Link]("Enter Email id");
14 String email=[Link]();
15 [Link]("Enter Movie name");
16 String mnm=[Link]();
17 [Link]("Enter number of tickets");
18 int tno=[Link]();
19 [Link]("Do you want AC or not");
20 String choice =[Link]();
21 if([Link]("PLATINUM")){
22 PlatinumTicket PT= new PlatinumTicket(tid,cnm,mno,email,mnm);
23 boolean b1=[Link]();
24 if(b1==true){
25 double cost=[Link](tno, choice);
26 [Link]("Ticket cost is "+[Link]("%.2f",cost));
27 }
28 else if(b1==false){
29 [Link]("Provide valid Ticket Id");
30 [Link](0);
31 }
32 }
33 else if([Link]("GOLD")){
34 GoldTicket GT= new GoldTicket(tid,cnm,mno,email,mnm);
35 boolean b2=[Link]();
36 if(b2==true){
37 double cost=[Link](tno,choice);
38 [Link]("Ticket cost is "+[Link]("%.2f",cost));
39 }
40 else if (b2==false){
41 [Link]("Provide valid Ticket Id");
42 [Link](0);
43 }
44 }
45 else if([Link]("SILVER")){
46 SilverTicket ST= new SilverTicket(tid,cnm,mno,email,mnm);
47 boolean b3=[Link]();
48 if(b3==true){
49 double cost=[Link](tno,choice);
50 [Link]("Ticket cost is "+[Link]("%.2f",cost));
51 }
52 else if (b3==false){
53 [Link]("Provide valid Ticket Id");
54 [Link](0);
55 }
56 }
57 }
58 }
59
60
Grade
Reviewed on Monday, 7 February 2022, 4:18 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
============================================================================
Group-2
1. Flight record retrieval
Grade settings: Maximum grade: 100
Based on: JAVA CC JDBC - MetaData V1 - ORACLE (w/o Proj Struc)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 32 s
You being their software consultant have been approached by them to develop an application
which can be used for managing their business. You need to implement a java program to view
all the flight based on source and destination.
int
noOfSeats
double
flightFare
Note: The class and methods should be declared as public and all the attributes should be
declared as private.
Requirement 1: Retrieve all the flights with the given source and destination
The customer should have the facility to view flights which are from a particular source to
destination. Hence the system should fetch all the flight details for the given source and
destination from the database. Those flight details should be added to a ArrayList and return the
same.
The flight table is already created at the backend. The structure of flight table is:
To connect to the database you are provided with [Link] file and [Link] file. (Do
not change any values in [Link] file)
Create a class called Main with the main method and get the inputs
like source and destination from the user.
Display the details of flight such as flightId, noofseats and flightfare for all the flights returned
as ArrayList<Flight> from the
method viewFlightBySourceDestination in FlightManagementSystem class.
If no flight is available in the list, the output should be “No flights available for the given source
and destination”.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
Malaysia
Singapore
18221 50 5000.0
Malaysia
Dubai
Automatic evaluation[+]
[Link]
1
2 public class Flight {
3
4 private int flightId;
5 private String source;
6 private String destination;
7 private int noOfSeats;
8 private double flightFare;
9 public int getFlightId() {
10 return flightId;
11 }
12 public void setFlightId(int flightId) {
13 [Link] = flightId;
14 }
15 public String getSource() {
16 return source;
17 }
18 public void setSource(String source) {
19 [Link] = source;
20 }
21 public String getDestination() {
22 return destination;
23 }
24 public void setDestination(String destination) {
25 [Link] = destination;
26 }
27 public int getNoOfSeats() {
28 return noOfSeats;
29 }
30 public void setNoOfSeats(int noOfSeats) {
31 [Link] = noOfSeats;
32 }
33 public double getFlightFare() {
34 return flightFare;
35 }
36 public void setFlightFare(double flightFare) {
37 [Link] = flightFare;
38 }
39 public Flight(int flightId, String source, String destination,
40 int noOfSeats, double flightFare) {
41 super();
42 [Link] = flightId;
43 [Link] = source;
44 [Link] = destination;
45 [Link] = noOfSeats;
46 [Link] = flightFare;
47 }
48
49
50
51 }
52
[Link]
1 import [Link];
2 import [Link].*;
3
4
5 public class FlightManagementSystem {
6
7 public ArrayList<Flight> viewFlightBySourceDestination(String source, String destination){
8 ArrayList<Flight> flightList = new ArrayList<Flight>();
9 try{
10 Connection con = [Link]();
11
12 String query="SELECT * FROM flight WHERE source= '" + source + "' AND destination= '" +
destination + "' ";
13
14 Statement st=[Link]();
15
16 ResultSet rst= [Link](query);
17
18 while([Link]()){
19 int flightId= [Link](1);
20 String src=[Link](2);
21 String dst=[Link](3);
22 int noofseats=[Link](4);
23 double flightfare=[Link](5);
24
25 [Link](new Flight(flightId, src, dst, noofseats, flightfare));
26 }
27 }catch(ClassNotFoundException | SQLException e){
28 [Link]();
29 }
30 return flightList;
31 }
32
33 }
[Link]
1 import [Link];
2 import [Link];
3
4 public class Main{
5 public static void main(String[] args){
6 Scanner sc=new Scanner([Link]);
7 [Link]("Enter the source");
8 String source=[Link]();
9 [Link]("Enter the destination");
10 String destination=[Link]();
11
12 FlightManagementSystem fms= new FlightManagementSystem();
13 ArrayList<Flight> flightList=[Link](source,destination);
14 if([Link]()){
15 [Link]("No flights available for the given source and destination");
16 return;
17 }
18 [Link]("Flightid Noofseats Flightfare");
19 for(Flight flight : flightList){
20 [Link]([Link]()+" "+[Link]()+" "+[Link]());
21 }
22
23 }
24 }
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7
8 public class DB {
9
10 private static Connection con = null;
11 private static Properties props = new Properties();
12
13
14 //ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
15 public static Connection getConnection() throws ClassNotFoundException, SQLException {
16 try{
17
18 FileInputStream fis = null;
19 fis = new FileInputStream("[Link]");
20 [Link](fis);
21
22 // load the Driver Class
23 [Link]([Link]("DB_DRIVER_CLASS"));
24
25 // create the connection now
26 con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),[Link]
operty("DB_PASSWORD"));
27 }
28 catch(IOException e){
29 [Link]();
30 }
31 return con;
32 }
33 }
34
[Link]
1 #IF NEEDED, YOU CAN MODIFY THIS PROPERTY FILE
2 #ENSURE YOU ARE NOT CHANGING THE NAME OF THE PROPERTY
3 #YOU CAN CHANGE THE VALUE OF THE PROPERTY
4 #LOAD THE DETAILS OF DRIVER CLASS, URL, USERNAME AND PASSWORD IN [Link] using this
properties file only.
5 #Do not hard code the values in [Link].
6
7 DB_DRIVER_CLASS=[Link]
8 DB_URL=jdbc:oracle:thin:@[Link]:1521:XE
9 DB_USERNAME=${sys:db_username}
10 DB_PASSWORD=${sys:db_password}
11
Grade
Reviewed on Monday, 7 February 2022, 6:33 PM by Automatic grade
Grade 100 / 100
Assessment report
Assessment Completed Successfully
[+]Grading and Feedback
=============================================
2. Get Text and Display Welcome Message
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
Amir owns “Bouncing Babies” an exclusive online store for baby toys.
He desires to display a welcome message whenever a customer visits his online store and
makes a purchase.
Help him do this by incorporating the customer name using the Lambda expression.
In the Main class write the main method and perform the given steps :
Note :
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Ensure to provide the name for classes, interfaces and methods as specified in the question.
Watson
Sample Output 1 :
Welcome Watson
Automatic evaluation[+]
[Link]
1 import [Link].*;
2 @FunctionalInterface
3 public interface DisplayText
4{
5 public void displayText(String text);
6 public default String getInput()
7 {
8 Scanner read = new Scanner([Link]);
9 String str = [Link]();
10 return str;
11 //return null;
12 }
13 }
[Link]
1 public class Main
2{
3 public static DisplayText welcomeMessage()
4 {
5
6 DisplayText dis = (str)->{
7
8 [Link]("Welcome "+str);
9 };
10 return dis;
11 }
12 public static void main(String args[])
13 {
14 DisplayText dis=welcomeMessage();
15 String text = [Link]();
16 [Link](text);
17
18 }
19 }
Grade
Reviewed on Wednesday, 1 December 2021, 10:14 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
=============================================
3. Generate Password
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Important Instructions:
· Do not change the Skeleton code or the package structure, method names, variable
names, return types, exception clauses, access specifiers etc.
· You can create any number of private methods inside the given class.
· You can test your code from main() method of the program
The system administrator of an organization wants to set password for all the computers for
security purpose. To generate a strong password, he wants to combine the username of each
user of the system with the reverse of their respective usernames. Help them by using Lambda
expressions that caters to their requirement.
Requirement 1: PasswordInfo
The Administrator wants to generate password for each system by making use
of the passwordGeneration method based on the username which is passed as a string.
In the Computer class write the main method and perform the given steps:
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
Ensure to use the lambda expression.
Ensure to follow the object oriented specifications provided in the question.
Ensure to provide the name for classes, interfaces and methods as specified in the
question.
Adhere to the code template, if provided.
Sample Input 1:
Enter system no
Tek/1234
Enter username
Manoj Kumar
Sample Output 1:
Password Info
=========================================================================
· Do not change the Skeleton code or the package structure, method names, variable
names, return types, exception clauses, access specifiers etc.
· You can create any number of private methods inside the given class.
· You can test your code from the main() method of the program.
Watican Museum is one of the famous museums, they have collections of houses paintings, and
sculptures from artists. The Museum management stores their visitor's details in a text file. Now,
they need an application to analyze and manipulate the visitor details based on the visitor visit
date and the visitor address.
You are provided with a text file – [Link], which contains all the visitor details
like the visitor Id, visitor name, mobile number, date of visiting and address. Your
application should satisfy the following requirements.
2. View visitor details which are above a particular mentioned visitor address.
You are provided with a code template which includes the following:
Note:
The Visitor class and the Main class will be provided with all the necessary codes. Please
do not edit or delete any line of the code in these two classes.
Fill your code in the InvalidVisitorIdException class to create a constructor as described
in the functional requirements below.
Fill your code in the respective methods of VisitorUtility class to fulfil all the functional
requirements.
In the [Link] file, each visitor detail has information separated by a comma,
and it is given as one customer detail per line.
Functional Requirements:
Fill your code in the respective class and method declarations based on the required
functionalities as given below.
Note:
Validation Rules:
Example.
WM_A23
InvalidVisitorIdException Create a constructor with a This class Should inherit the Exception
single String argument and class. The constructor should pass the
pass it to the parent class String message which is thrown to it by
constructor. calling the parent class constructor.
Requirement 2: View visitor details which are above a particular mentioned address
1. All inputs/ outputs for processing the functional requirements should be case sensitive.
2. Adhere to the Sample Inputs/ Outputs
3. In the Sample Inputs/ Outputs provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
4. All the Date values used in this application must be in “dd-MM-yyyy” format.
5. Adhere to the code template.
6. Fill all your required codes in the respective blocks. Do not edit or delete the codes
provided in the code template.
7. The Sample Inputs/ Outputs given below are generated based on the Sample data given
in the [Link] file.
8. Please do not hard code the output.
1. ViewVisitorDetailsByDateOfVisiting
2. ViewVisitorDetailsByAddress
07-04-2012
1. viewVisitorDetailsByDateOfVisiting
2. viewVisitorDetailsByAddress
Eastbourne
Requirements:
3. Retrieve the patient details which are from a particular area (address).
String
patientName
String
contactNumber
String dateOfVisit
String
patientAddress
You are provided with a text file –[Link], which contains all the patient details like the
patient Id, patient name, contact number, date of visit, and patient address. You can add any
number of records in the text file to test your code.
Note:
· In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user, and the rest of the text represents the output.
· Ensure to provide the names for classes, attributes, and methods as specified in the
question description.
Sample Input/Output 1:
1. By Date of Visit
2. By Address
Enter your choice:
02-03-2003
02-12-2005
Sample Input/Output 2:
1. By Date of Visit
2. By Address
Carolina
1. By Date of Visit
2. By Address
03-02-2020
02-02-2021
Sample Input/Output 4:
1. By Date of Visit
2. By Address
Enter your choice:
Invalid Option
Automatic evaluation[+]
HospitalManagement/[Link]
1 WM_J82,Jacey,8734909012,07-08-2001,Colorado
2 WM_L01,Bella,9435678631,21-09-1992,Connecticut
3 WM_52E,Berey,8754321256,20-03-1999,Indiana
4 WM_B83,Cappi,6709543276,13-02-2006,Pennsylvania
5 WM_C23,Anya,7656548798,23-11-2002,Carolina
6 WM_X26,Beatrice,6789567687,18-07-2004,Texas
7 WM_H72,Elise,9809908765,02-12-2005,Washington
8 WM_P10,Fanny,7835627189,02-05-2001,Virginia
9 WM_Q12,Felicity,6792637810,21-05-1997,Colorado
10 WM_K7K,Abigail,8934562718,02-05-2016,Indiana
11 WM_U82,Alice,8352617181,11-05-2012,Indiana
12 WN_P23,Amber,9876567898,12-09-1998,Pennsylvania
13 LM_V20,Gabriella,8302927382,02-05-2006,Connecticut
14 WM_Z05,Hadley,7823919273,02-06-2007,Connecticut
15 WM_T83,Harper,7391027349,08-07-1999,Carolina
16 WM_M03,Iris,9102638491,27-05-2001,Texas
17 WM_N32,Finley,8729196472,12-08-2003,Pennsylvania
18 WM_WQ0,Fiona,7201982219,09-09-2014,Washington
19 WM_Q91,Carny,8976509871,30-12-2003,Virginia
20 WM_P21,Eleanor,8954321378,24-11-2007,Carolina
HospitalManagement/src/[Link]
1
2 //public class InvalidPatientIdException{
3 //FILL THE CODE HERE
4 public class InvalidPatientIdException extends Exception{
5 public InvalidPatientIdException(String message){
6 super(message);
7 }
8 }
9
10
11
12
HospitalManagement/src/[Link]
1 public class Main {
2
3 public static void main(String[] args){
4
5 // CODE SKELETON - VALIDATION STARTS
6 // DO NOT CHANGE THIS CODE
7
8 new SkeletonValidator();
9 // CODE SKELETON - VALIDATION ENDS
10
11 // FILL THE CODE HERE
12
13 }
14
15 }
16
17
HospitalManagement/src/[Link]
1 //DO NOT ADD/EDIT THE CODE
2 public class Patient {
3
4 private String patientId;
5 private String patientName;
6 private String contactNumber;
7 private String dateOfVisit;
8 private String patientAddress;
9
10 //Setters and Getters
11
12 public String getPatientId() {
13 return patientId;
14 }
15 public void setPatientId(String patientId) {
16 [Link] = patientId;
17 }
18 public String getPatientName() {
19 return patientName;
20 }
21 public void setPatientName(String patientName) {
22 [Link] = patientName;
23 }
24 public String getContactNumber() {
25 return contactNumber;
26 }
27 public void setContactNumber(String contactNumber) {
28 [Link] = contactNumber;
29 }
30 public String getDateOfVisit() {
31 return dateOfVisit;
32 }
33 public void setDateOfVisit(String dateOfVisit) {
34 [Link] = dateOfVisit;
35 }
36 public String getPatientAddress() {
37 return patientAddress;
38 }
39 public void setPatientAddress(String patientAddress) {
40 [Link] = patientAddress;
41 }
42
43
44
45
46 }
47
HospitalManagement/src/[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7 import [Link].*;
8 import [Link];
9 import [Link];
10 import [Link];
11 import [Link];
12
13
14 public class PatientUtility {
15
16 public List <Patient> fetchPatient(String filePath) {
17
18
19 //FILL THE CODE HERE
20 List <Patient> patients =new ArrayList<>();
21 try{
22 File register =new File(filePath);
23 Scanner reader=new Scanner(register);
24 while([Link]()){
25 Patient p = new Patient();
26 String[] infos=[Link]().split(",");
27 try{
28 if(isValidPatientId(infos[0])){
29 [Link](infos[0]);
30 [Link](infos[1]);
31 [Link](infos[2]);
32 [Link](infos[3]);
33 [Link](infos[4]);
34 [Link](p);
35 }
36 }
37 catch(InvalidPatientIdException e1){
38 [Link]([Link]());
39 }
40 }
41 [Link]();
42 }
43 catch(FileNotFoundException e){}
44 return patients;
45
46 //return null;
47 }
48
49
50 public boolean isValidPatientId (String patientId)throws InvalidPatientIdException
51 {
52
53 //FILL THE CODE HERE
54 Pattern p =[Link]("WM_[A-Z][0-9]{2}$");
55 Matcher m=[Link](patientId);
56 boolean ne =[Link]();
57 if(!ne){
58 throw new InvalidPatientIdException(patientId+"is an Invalid Patient Id.");
59
60 }
61 //return inValid;
62 return ne;
63 }
64
65
66 public List<Patient> retrievePatientRecords_ByDateOfVisit(Stream<Patient> patientStream, String
fromDate, String toDate)
67 {
68 //FILL THE CODE HERE
69 SimpleDateFormat simpleDateFormat=new SimpleDateFormat("dd-MM-yyyy");
70 return patientStream
71 .filter((p)->{
72 try{
73 Date start=[Link](fromDate);
74 Date end= [Link](toDate);
75 Date current =[Link]([Link]());
76 return [Link](current)*[Link](end)>=0;
77 }
78 catch(ParseException e){}
79 return false;
80 }).collect([Link]());
81 // return null;
82 }
83
84
85
86 public Stream<Patient> retrievePatientRecords_ByAddress(Stream<Patient> patientStream, String
address)
87 {
88
89 //FILL THE CODE HERE
90 return [Link](p->[Link]([Link]()));
91 //return null;
92
93
94
95 }
96
97 }
98
HospitalManagement/src/[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6
7 /**
8 * @author TJ
9 *
10 * This class is used to verify if the Code Skeleton is intact and not modified by participants thereby ensuring
smooth auto evaluation
11 *
12 */
13 public class SkeletonValidator {
14
15 public SkeletonValidator() {
16
17
18 validateClassName("Patient");
19 validateClassName("PatientUtility");
20 validateClassName("InvalidPatientIdException");
21 validateMethodSignature(
22
"fetchPatient:[Link],isValidPatientId:boolean,retrievePatientRecords_ByDateOfVisit:[Link]
,retrievePatientRecords_ByAddress:[Link]",
23 "PatientUtility");
24
25 }
26
27 private static final Logger LOG = [Link]("SkeletonValidator");
28
29 protected final boolean validateClassName(String className) {
30
31 boolean iscorrect = false;
32 try {
33 [Link](className);
34 iscorrect = true;
35 [Link]("Class Name " + className + " is correct");
36
37 } catch (ClassNotFoundException e) {
38 [Link]([Link], "You have changed either the " + "class
name/package. Use the correct package "
39 + "and class name as provided in the skeleton");
40
41 } catch (Exception e) {
42 [Link]([Link],
43 "There is an error in validating the " + "Class Name.
Please manually verify that the "
44 + "Class name is same as
skeleton before uploading");
45 }
46 return iscorrect;
47
48 }
49
50 protected final void validateMethodSignature(String methodWithExcptn, String className) {
51 Class cls = null;
52 try {
53
54 String[] actualmethods = [Link](",");
55 boolean errorFlag = false;
56 String[] methodSignature;
57 String methodName = null;
58 String returnType = null;
59
60 for (String singleMethod : actualmethods) {
61 boolean foundMethod = false;
62 methodSignature = [Link](":");
63
64 methodName = methodSignature[0];
65 returnType = methodSignature[1];
66 cls = [Link](className);
67 Method[] methods = [Link]();
68 for (Method findMethod : methods) {
69 if ([Link]([Link]())) {
70 foundMethod = true;
71 if
(!([Link]().getName().equals(returnType))) {
72 errorFlag = true;
73 [Link]([Link], " You
have changed the " + "return type in '" + methodName
74 + "'
method. Please stick to the " + "skeleton provided");
75
76 } else {
77 [Link]("Method signature of "
+ methodName + " is valid");
78 }
79
80 }
81 }
82 if (!foundMethod) {
83 errorFlag = true;
84 [Link]([Link], " Unable to find the given
public method " + methodName
85 + ". Do not change the " + "given
public method name. " + "Verify it with the skeleton");
86 }
87
88 }
89 if (!errorFlag) {
90 [Link]("Method signature is valid");
91 }
92
93 } catch (Exception e) {
94 [Link]([Link],
95 " There is an error in validating the " + "method
structure. Please manually verify that the "
96 + "Method signature is same as
the skeleton before uploading");
97 }
98 }
99
100 }
Grade
Reviewed on Monday, 7 February 2022, 6:04 PM by Automatic grade
Grade 100 / 100
Assessment report
Assessment Completed Successfully
[+]Grading and Feedback
=========================================================================
6. Technology Fest
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
String collegeName
String eventName
double registrationFee
Requirements:
· To calculate the registration fee of the participant based on the event name.
int counter
EventManagement public void Calculate the registration
calculateRegistrationFee(List fee of the participant
<Participant> list) based on the event name.
If the event name doesn’t
exist, throw an
InvalidEventException
with an error message
“Event Name is invalid”.
EventManagement public void run() Calculate the number of
participants registered for
a particular event.
Increment the counter
attribute based on the
search.
Note: The class and methods should be declared as public and all the attributes should be
declared as private.
Create a class called Main with the main method and perform the tasks are given below:
· Get the event type to search to find the number of the participants registered for that
particular event.
· In the Sample Input / Output provided, the highlighted text in bold corresponds to the input
given by the user and the remaining text represent the output.
· Ensure to provide the names for classes, attributes, and methods as specified in the
question description.
Sample Input/Output 1:
rinu/4/EEE/mnm/robocar
fina/3/EEE/psg/papertalk
rachel/4/civil/kcg/quiz
robocar
Sample Input/Output 2:
rinu/4/EEE/mnm/robocar
fina/3/EEE/psg/papertalk
rachel/4/civil/kcg/quiz
games
No participant found
Sample Input/Output 3:
vishal/4/mech/vjc/flyingrobo
vivek/3/mech/hdl/games
Automatic evaluation[+]
TechnologyFest/src/[Link]
1 import [Link];
2
3 public class EventManagement implements Runnable {
4 private List<Participant> TechList;
5 private String searchEvent;
6 private int counter=0;
7 public List<Participant>getTechList()
8 {
9 return TechList;
10
11 }
12 public void setTechList(List<Participant>techList)
13 {
14 TechList=techList;
15 }
16 public String getSearchEvent()
17 {
18 return searchEvent;
19 }
20 public void setSearchEvent(String searchEvent)
21 {
22 [Link]=searchEvent;
23 }
24 public int getCounter()
25 {
26 return counter;
27 }
28 public void setCounter(int counter)
29 {
30 [Link]=counter;
31 }
32 //FILL THE CODE HERE
33
34 public void calculateRegistrationFee(List<Participant> list) throws InvalidEventException
35
36 {
37 for(Participant p:list)
38 {
39 if([Link]().equalsIgnoreCase("robocar"))
40 {
41 [Link](1000);
42 }
43 else if([Link]().equalsIgnoreCase("papertalk")){
44 [Link](500);
45
46 }
47
48 else if([Link]().equalsIgnoreCase("quiz")){
49 [Link](300);
50 }
51 else if([Link]().equalsIgnoreCase("games")){
52 [Link](100);
53 }
54 else{
55 throw new InvalidEventException("Event Name is Invalid");
56 }
57 }
58 //FILL THE CODE HERE
59 setTechList(list);
60 }
61
62 public void run()
63 {
64 String str="robocarpapertalkquizgames";
65 if([Link]([Link]())){
66 for(Participant P:[Link]()){
67 if([Link]().equals([Link]())){
68 counter++;
69 }
70 }
71 }
72 setCounter(counter);
73
74 //FILL THE CODE HERE
75
76 }
77 }
78
TechnologyFest/src/[Link]
1 public class InvalidEventException extends Exception{
2 //FILL THE CODE HERE
3 public InvalidEventException(String str){
4 super(str);
5
6}
7
8}
9
TechnologyFest/src/[Link]
1
2 import [Link];
3 import [Link].*;
4 public class Main {
5 public static void main(String [] args)
6 {
7 // CODE SKELETON - VALIDATION STARTS
8 // DO NOT CHANGE THIS CODE
9
10 new SkeletonValidator();
11
12 // CODE SKELETON - VALIDATION ENDS
13
14 Scanner sc=new Scanner([Link]);
15 [Link]("Enter the number of entries");
16 int n=[Link]();
17 [Link]("Enter the Participant
Name/Yearofstudy/Department/CollegeName/EventName");
18 List<Participant> list=new ArrayList<Participant>();
19 String strlist[]=new String[n];
20 for(int i=0;i<n;i++)
21 {
22 strlist[i]=[Link]();
23 String a[]=strlist[i].split("/");
24 Participant pt=new Participant(a[0],a[1],a[2],a[3],a[4]);
25 [Link](pt);
26 }
27 EventManagement em=new EventManagement();
28 try {
29 [Link](list);
30 }
31 catch(InvalidEventException e)
32 {
33 [Link]();
34
35 }
36 [Link]("Print participant details");
37 for(Participant p:list)
38 {
39 [Link](p);
40 }
41 [Link]("Enter the event to search");
42 String srch=[Link]();
43 [Link](srch);
44 [Link]();
45 int count=[Link]();
46 if(count<=0){
47 [Link]("No participant found");
48
49 }
50 else{
51 [Link]("Number of participants for"+srch+"event is "+count); }
52 }
53 }
54
55
56
57
TechnologyFest/src/[Link]
1 public class Participant {
2 private String name;
3 private String yearofstudy;
4 private String department;
5 private String collegeName;
6 private String eventName;
7 private double registrationFee;
8
9 //5 argument Constructor
10 public Participant(String name, String yearofstudy, String department, String collegeName, String
eventName) {
11 super();
12 [Link] = name;
13 [Link] = yearofstudy;
14 [Link] = department;
15 [Link] = collegeName;
16 [Link] = eventName;
17 }
18
19 public String getName() {
20 return name;
21 }
22 public void setName(String name) {
23 [Link] = name;
24 }
25 public String getYearofstudy() {
26 return yearofstudy;
27 }
28 public void setYearofstudy(String yearofstudy) {
29 [Link] = yearofstudy;
30 }
31 public String getDepartment() {
32 return department;
33 }
34 public void setDepartment(String department) {
35 [Link] = department;
36 }
37 public String getCollegeName() {
38 return collegeName;
39 }
40 public void setCollegeName(String collegeName) {
41 [Link] = collegeName;
42 }
43 public String getEventName() {
44 return eventName;
45 }
46 public void setEventName(String eventName) {
47 [Link] = eventName;
48 }
49 public double getRegistrationFee() {
50 return registrationFee;
51 }
52 public void setRegistrationFee(double registrationFee) {
53 [Link] = registrationFee;
54 }
55
56 @Override
57 public String toString() {
58 return "Participant [name=" + name + ", yearofstudy=" + yearofstudy + ", department=" +
department
59 + ", collegeName=" + collegeName + ", eventName=" +
eventName + ", registrationFee=" + registrationFee
60 + "]";
61 }
62
63
64
65
66 }
67
TechnologyFest/src/[Link]
1
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7
8 /**
9 * @author TJ
10 *
11 * This class is used to verify if the Code Skeleton is intact and not modified by participants thereby ensuring
smooth auto evaluation
12 *
13 */
14 public class SkeletonValidator {
15
16 public SkeletonValidator() {
17
18 //classes
19 validateClassName("Main");
20 validateClassName("EventManagement");
21 validateClassName("Participant");
22 validateClassName("InvalidEventException");
23 //functional methods
24 validateMethodSignature(
25 "calculateRegistrationFee:void","EventManagement");
26 validateMethodSignature(
27 "run:void","EventManagement");
28
29 //setters and getters of HallHandler
30 validateMethodSignature(
31 "getTechList:List","EventManagement");
32 validateMethodSignature(
33 "setTechList:void","EventManagement");
34
35 validateMethodSignature(
36 "getCounter:int","EventManagement");
37 validateMethodSignature(
38 "setCounter:void","EventManagement");
39
40 validateMethodSignature(
41 "getSearchEvent:String","EventManagement");
42 validateMethodSignature(
43 "setSearchEvent:void","EventManagement");
44
45 //setters and getters of Hall
46 validateMethodSignature(
47 "getName:String","Participant");
48 validateMethodSignature(
49 "setName:void","Participant");
50
51 validateMethodSignature(
52 "getYearofstudy:String","Participant");
53 validateMethodSignature(
54 "setYearofstudy:void","Participant");
55
56 validateMethodSignature(
57 "getDepartment:String","Participant");
58 validateMethodSignature(
59 "setDepartment:void","Participant");
60
61 validateMethodSignature(
62 "getCollegeName:String","Participant");
63 validateMethodSignature(
64 "setCollegeName:void","Participant");
65
66 validateMethodSignature(
67 "getEventName:String","Participant");
68 validateMethodSignature(
69 "setEventName:void","Participant");
70
71 validateMethodSignature(
72 "getRegistrationFee:double","Participant");
73 validateMethodSignature(
74 "setRegistrationFee:void","Participant");
75
76 }
77
78 private static final Logger LOG = [Link]("SkeletonValidator");
79
80 protected final boolean validateClassName(String className) {
81
82 boolean iscorrect = false;
83 try {
84 [Link](className);
85 iscorrect = true;
86 [Link]("Class Name " + className + " is correct");
87
88 } catch (ClassNotFoundException e) {
89 [Link]([Link], "You have changed either the " + "class
name/package. Use the correct package "
90 + "and class name as provided in the skeleton");
91
92 } catch (Exception e) {
93 [Link]([Link],
94 "There is an error in validating the " + "Class Name.
Please manually verify that the "
95 + "Class name is same as
skeleton before uploading");
96 }
97 return iscorrect;
98
99 }
100
101 protected final void validateMethodSignature(String methodWithExcptn, String className) {
102 Class cls = null;
103 try {
104
105 String[] actualmethods = [Link](",");
106 boolean errorFlag = false;
107 String[] methodSignature;
108 String methodName = null;
109 String returnType = null;
110
111 for (String singleMethod : actualmethods) {
112 boolean foundMethod = false;
113 methodSignature = [Link](":");
114
115 methodName = methodSignature[0];
116 returnType = methodSignature[1];
117 cls = [Link](className);
118 Method[] methods = [Link]();
119 for (Method findMethod : methods) {
120 if ([Link]([Link]())) {
121 foundMethod = true;
122 if
(!([Link]().getName().contains(returnType))) {
123 errorFlag = true;
124 [Link]([Link], " You
have changed the " + "return type in '" + methodName
125 + "'
method. Please stick to the " + "skeleton provided");
126
127 } else {
128 [Link]("Method signature of "
+ methodName + " is valid");
129 }
130
131 }
132 }
133 if (!foundMethod) {
134 errorFlag = true;
135 [Link]([Link], " Unable to find the given
public method " + methodName
136 + ". Do not change the " + "given
public method name. " + "Verify it with the skeleton");
137 }
138
139 }
140 if (!errorFlag) {
141 [Link]("Method signature is valid");
142 }
143
144 } catch (Exception e) {
145 [Link]([Link],
146 " There is an error in validating the " + "method
structure. Please manually verify that the "
147 + "Method signature is same as
the skeleton before uploading");
148 }
149 }
150
151 }
Grade
Reviewed on Monday, 7 February 2022, 6:34 PM by Automatic grade
Grade 74 / 100
Assessment report
Fail 1 -- test4CheckTheOutput::
$Expected output:"[Print participant details
ParticipantName=Weni
Yearofstudy=3
Department=civil
CollegeName=vjc
EventName=robocar
RegistrationFee=1000.0
ParticipantName=gina
Yearofstudy=2
Department=mech
CollegeName=vjc
EventName=quiz
RegistrationFee=300.0
ParticipantName=jos
Yearofstudy=4
Department=ece
CollegeName=vjec
EventName=games
RegistrationFee=100.0
ParticipantName=fida
Yearofstudy=1
Department=eee
CollegeName=vjec
EventName=papertalk
RegistrationFee=500.0
Enter the event to search
Number of participants for PAPERTALK event is 1]" Actual output:"[Enter the number of
entries
Enter the Participant Name/Yearofstudy/Department/CollegeName/EventName
Print participant details
Participant [name=Weni
yearofstudy=3
department=civil
collegeName=vjc
eventName=robocar
registrationFee=1000.0]
Participant [name=gina
yearofstudy=2
department=mech
collegeName=vjc
eventName=quiz
registrationFee=300.0]
Participant [name=jos
yearofstudy=4
department=ece
collegeName=vjec
eventName=games
registrationFee=100.0]
Participant [name=fida
yearofstudy=1
department=eee
collegeName=vjec
eventName=papertalk
registrationFee=500.0]
Enter the event to search
No participant found]"$
Check your code with the input :Weni/3/civil/vjc/robocar
gina/2/mech/vjc/quiz
jos/4/ece/vjec/games
fida/1/eee/vjec/papertalk
Fail 2 -- test6CheckTheOutputfor_NCount::
$Expected output:"[Print participant details
ParticipantName=philip
Yearofstudy=4
Department=eee
CollegeName=mvc
EventName=robocar
RegistrationFee=1000.0
ParticipantName=susan
Yearofstudy=4
Department=eee
CollegeName=mvc
EventName=robocar
RegistrationFee=1000.0
ParticipantName=vivek
Yearofstudy=3
Department=civil
CollegeName=mvc
EventName=quiz
RegistrationFee=300.0
ParticipantName=vishal
Yearofstudy=3
Department=civil
CollegeName=mvc
EventName=papertalk
RegistrationFee=500.0
Enter the event to search
Number of participants for ROBOCAR event is 2]" Actual output:"[Enter the number of
entries
Enter the Participant Name/Yearofstudy/Department/CollegeName/EventName
Print participant details
Participant [name=philip
yearofstudy=4
department=eee
collegeName=mvc
eventName=robocar
registrationFee=1000.0]
Participant [name=susan
yearofstudy=4
department=eee
collegeName=mvc
eventName=robocar
registrationFee=1000.0]
Participant [name=vivek
yearofstudy=3
department=civil
collegeName=mvc
eventName=quiz
registrationFee=300.0]
Participant [name=vishal
yearofstudy=3
department=civil
collegeName=mvc
eventName=papertalk
registrationFee=500.0]
Enter the event to search
No participant found]"$
Check your code with the input :philip/4/eee/mvc/robocar
susan/4/eee/mvc/robocar
vivek/3/civil/mvc/quiz
vishal/3/civil/mvc/papertalk
robocar
Obtained Pass Percentage. Still few testcases failed . Kindly revisit the Solution
[+]Grading and Feedback
Powered by
====================================================================
[Link] code Technology
Casual Employee:
public class CasualEmployee extends Employee{
}
Employee:
public abstract class Employee {
}
User Interface:
import [Link];
public class UserInterface {
[Link] Cinemas
Gold Ticket:
public class GoldTicket extends BookAMovieTicket {
public GoldTicket(String ticketId, String customerName, long mobileNumber,
String emailId, String movieName) {
super(ticketId, customerName, mobileNumber, emailId, movieName);
}
public boolean validateTicketId(){
int count=0;
if([Link]("GOLD"));
count++;
char[] cha=[Link]();
for(int i=4;i<7;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
}
if(count==4)
return true;
else
return false;
}
public double calculateTicketCost(int numberOfTickets,String ACFacility){
double amount;
if([Link]("yes")){
amount=500*numberOfTickets;
}
else{
amount=350*numberOfTickets;
}
return amount;
}
}
Platinum Ticket:
public class PlatinumTicket extends BookAMovieTicket
{
public PlatinumTicket(String ticketId, String customerName, long mobileNumber,String
emailId, String movieName)
{
super(ticketId, customerName, mobileNumber, emailId, movieName);
}
public boolean validateTicketId(){
int count=0;
if([Link]("PLATINUM"));
count++;
char[] cha=[Link]();
for(int i=8;i<11;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
}
if(count==4)
return true;
else
return false;
}
public double calculateTicketCost(int numberOfTickets,String ACFacility){
double amount;
if([Link]("yes")){
amount=750*numberOfTickets;
}
else{
amount=600*numberOfTickets;
}
return amount;
}
}
Silver Ticket:
public class SilverTicket extends BookAMovieTicket{
public SilverTicket(String ticketId, String customerName, long mobileNumber,String emailId,
String movieName)
{
super(ticketId, customerName, mobileNumber, emailId, movieName);
}
public boolean validateTicketId(){
int count=0;
if([Link]("SILVER"));
count++;
char[] cha=[Link]();
for(int i=6;i<9;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
}
if(count==4)
return true;
else
return false;
}
public double calculateTicketCost(int numberOfTickets,String ACFacility){
double amount;
if([Link]("yes")){
amount=250*numberOfTickets;
}
else{
amount=100*numberOfTickets;
}
return amount;
}
}
User Interface:
import [Link].*;
public class UserInterface {
public static void main(String[] args) {
Scanner sc=new Scanner([Link]);
[Link]("Enter Ticket Id");
String tid=[Link]();
[Link]("Enter Customer Name");
String cnm=[Link]();
[Link]("Enter Mobile Number");
long mno=[Link]();
[Link]("Enter Email id");
String email=[Link]();
[Link]("Enter Movie Name");
String mnm=[Link]();
[Link]("Enter number of tickets");
int tno=[Link]();
[Link]("Do you want AC or not");
String choice =[Link]();
if([Link]("PLATINUM")){
PlatinumTicket PT=new PlatinumTicket(tid,cnm,mno,email,mnm);
boolean b1=[Link]();
if(b1==true){
double cost =[Link](tno, choice);
[Link]("Ticket cost is "+ cost);
}
else if(b1==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
else if([Link]("GOLD")){
GoldTicket GT=new GoldTicket(tid,cnm,mno,email,mnm);
boolean b2=[Link]();
if(b2==true){
double cost=[Link](tno, choice);
[Link]("Ticket cost is "+cost);
}
else if (b2==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
else if([Link]("SILVER")){
SilverTicket ST=new SilverTicket(tid,cnm,mno,email,mnm);
boolean b3=[Link]();
if(b3==true){
double cost=[Link](tno, choice);
[Link]("Ticket cost is "+cost);
}
else if(b3==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
}
}
[Link] Innovators
Main:
import [Link].*;
public class Main {
Air Conditioner:
public class AirConditioner extends ElectronicProducts {
private String airConditionerType;
private double capacity;
public AirConditioner(String productId, String productName, String batchId, String
dispatchDate, int warrantyYears, String airConditionerType, double capacity) {
super(productId, productName, batchId, dispatchDate, warrantyYears);
[Link] = airConditionerType;
[Link] = capacity;
}
public String getAirConditionerType() {
return airConditionerType;
}
public void setAirConditionerType(String airConditionerType) {
[Link] = airConditionerType;
}
public double getCapacity() {
return capacity;
}
public void setCapacity(double capacity) {
[Link] = capacity;
}
public double calculateProductPrice(){
double price = 0;
if([Link]("Residential")){
if (capacity == 2.5){
price = 32000;
}
else if(capacity == 4){
price = 40000;
}
else if(capacity == 5.5){
price = 47000;
}
}
else if([Link]("Commercial")){
if (capacity == 2.5){
price = 40000;
}
else if(capacity == 4){
price = 55000;
}
else if(capacity == 5.5){
price = 67000;
}
}
else if([Link]("Industrial")){
if (capacity == 2.5){
price = 47000;
}
else if(capacity == 4){
price = 60000;
}
else if(capacity == 5.5){
price = 70000;
}
}
return price;
}
}
Electronic Products:
public class ElectronicProducts {
protected String productId;
protected String productName;
protected String batchId;
protected String dispatchDate;
protected int warrantyYears;
public ElectronicProducts(String productId, String productName, String batchId,
String dispatchDate, int warrantyYears) {
[Link] = productId;
[Link] = productName;
[Link] = batchId;
[Link] = dispatchDate;
[Link] = warrantyYears;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
[Link] = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
[Link] = productName;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
[Link] = batchId;
}
public String getDispatchDate() {
return dispatchDate;
}
public void setDispatchDate(String dispatchDate) {
[Link] = dispatchDate;
}
public int getWarrantyYears() {
return warrantyYears;
}
public void setWarrantyYears(int warrantyYears) {
[Link] = warrantyYears;
}
}
LED TV:
public class LEDTV extends ElectronicProducts {
private int size;
private String quality;
public LEDTV(String productId, String productName, String batchId, String
dispatchDate, int warrantyYears, int size, String quality) {
super(productId, productName, batchId, dispatchDate, warrantyYears);
[Link] = size;
[Link] = quality;
}
public int getSize() {
return size;
}
public void setSize(int size) {
[Link] = size;
}
public String getQuality() {
return quality;
}
public void setQuality(String quality) {
[Link] = quality;
}
public double calculateProductPrice(){
double price = 0;
if([Link]("Low")){
price = size * 850;
}
else if([Link]("Medium")){
price = size * 1250;
}
else if([Link]("High")){
price = size * 1550;
}
return price;
}
}
Microwave Oven:
public class MicrowaveOven extends ElectronicProducts{
private int quantity;
private String quality;
public MicrowaveOven(String productId, String productName, String batchId, String
dispatchDate, int warrantyYears, int quantity, String quality) {
super(productId, productName, batchId, dispatchDate, warrantyYears);
[Link] = quantity;
[Link] = quality;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
[Link] = quantity;
}
public String getQuality() {
return quality;
}
public void setQuality(String quality) {
[Link] = quality;
}
public double calculateProductPrice(){
double price = 0;
if([Link]("Low")){
price = quantity * 1250;
}
else if([Link]("Medium")){
price = quantity * 1750;
}
else if([Link]("High")){
price = quantity * 2000;
}
return price;
}
}
User Interface:
import [Link];
public class UserInterface {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter Product Id");
String productId = [Link]();
[Link]("Enter Product Name");
String productName = [Link]();
[Link]("Enter Batch Id");
String batchId = [Link]();
[Link]("Enter Dispatch Date");
String dispatchDate = [Link]();
[Link]("Enter Warranty Years");
int warrantyYears = [Link]();
double price;
String quality;
switch(productName){
case "AirConditioner":
[Link]("Enter type of Air Conditioner");
String type = [Link]();
[Link]("Enter quantity");
double capacity = [Link]();
AirConditioner ac = new AirConditioner(productId, productName, batchId,
dispatchDate, warrantyYears, type, capacity);
price = [Link]();
[Link]("Price of the product is %.2f", price);
break;
case "LEDTV":
[Link]("Enter size in inches");
int size = [Link]();
[Link]("Enter quality");
quality = [Link]();
LEDTV l = new LEDTV(productId, productName, batchId, dispatchDate,
warrantyYears, size, quality);
price = [Link]();
[Link]("Price of the product is %.2f", price);
break;
case "MicrowaveOven":
[Link]("Enter quantity");
int quantity = [Link]();
[Link]("Enter quality");
quality = [Link]();
MicrowaveOven m = new MicrowaveOven(productId, productName, batchId,
dispatchDate, warrantyYears, quantity, quality);
price = [Link]();
[Link]("Price of the product is %.2f", price);
break;
default:
[Link]("Provide a valid Product name");
[Link](0);
}
}
}
5. Reverse a word
import [Link].*;
class HelloWorld {
public static void main(String[] args) {
String[] words ;
Scanner myObj = new Scanner([Link]);
[Link](words[[Link]-1]);
// reverse StringBuilder input1
input1= [Link]();
[Link](words[0]);
[Link](input1);
}
else {
[Link](words[0]);
// reverse StringBuilder input1
input1= [Link]();
[Link](words[[Link]-1]);
[Link](input1);
}
}
}
}
i
mpor
tjav
[Link]
il
.Scanner
;
publ
i
cclassMai n{
pri
vatestat
icintget
Sum(longnum){
char
[]chars=Long.
toStr
ing(
num).
toChar
Arr
ay(
);
i
ntsum =0;
f
or(
charch:
chars){
sum +=Char
acter
.di
git
(ch,
10)
;
}
r
etur
nsum;
}
pr
ivatestat
icintget
Numerol
ogy(
longnum){
Str
ingstr
ing=Stri
ng.
val
ueOf
(num);
whi
l
e(str
ing.
length(
)!=1){
st
ri
ng=St ri
ng.v
alueOf
(get
Sum(
Long.
par
seLong(
str
ing)
));
}
r
etur
nInt
eger
.par
seI
nt(
str
ing)
;
}
pr
ivat
estati
cintget
OddCount
(l
ongnum){
i
ntoddCount=0;
f
or(
charch:Long.t
oStri
ng(num)
.t
oChar
Arr
ay(
)){
if(
Character
.di
git
(ch,10)%2!=0){
++oddCount;
}
}
r
etur
noddCount
;
}
pr
ivat
estati
cintget
EvenCount
(l
ongnum){
i
ntev
enCount=0;
f
or(
charch:Long.t
oStri
ng(num)
.t
oChar
Arr
ay(
)){
if(
Character
.di
git
(ch,10)%2==0){
++evenCount;
}
}
r
etur
nev
enCount
;
}
publ
i
cstati
cv oi
dmai n(
Str
ing[
]ar
gs){
Scannerscanner=newScanner(
Syst
em.
i
n);
Syst
em.
out.
pri
ntl
n("
Enterthenumber
");
l
ongnum =scanner
.next
Long();
Sy
stem.
out
.pr
int
ln(
"Sum ofdi
git
s")
;
Sy
stem.
out
.pr
int
ln(
getSum(num));
Sy
stem.
out
.pr
int
ln(
"Numerol
ogynumber
");
Sy
stem.
out
.pr
int
ln(
getNumerol
ogy(
num)
);
Sy
stem.
out
.pr
int
ln(
"Numberofoddnumber
s")
;
Sy
stem.
out
.pr
int
ln(
getOddCount
(num)
);
Sy
stem.
out
.pr
int
ln(
"Numberofev
ennumber
s")
;
Sy
stem.
out
.pr
int
ln(
getEv
enCount
(num)
);
}
}
import [Link].*;
public class tourism {
static String name;
static String place;
static int days;
static int tickets;
static double price = 0.00;
static double total = 0.00;
public static void main(String[] args){
Scanner in = new Scanner([Link]);
[Link]("Enter the passenger name");
name = [Link]();
[Link]("Enter the place name");
place=[Link]();
if([Link]("beach")
||[Link]("pilgrimage")||
[Link]("heritage")||[Link]("Hills")||
[Link]("palls")||[Link]("adventure")){
[Link]("Enter the number of days");
days = [Link]();
if(days>0){
[Link]("Enter the number of Tickets");
tickets = [Link]();
if(tickets>0){
if([Link]("beach")){
price = tickets*270;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("prilgrimage")){
price = tickets*350;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("heritage")){
price = tickets*430;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else if([Link]("hills")){
price = tickets*780;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
This study source was downloaded by 100000841384095 from [Link] on 02-15-2022 03:25:30 GMT -06:00
[Link]
else if([Link]("palls")){
price = tickets*1200;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
else {
price = tickets*4500;
if(price>1000){
total = 85*price/100;
[Link]("Price:%.2f",total);
}
else {
[Link]("Price:%.2f",price);
}
}
}
else{
[Link](tickets+" is an Invalid no. of tickets");
}
}
else{
[Link](days+" is an Invalid no. of days");
}
}
else {
[Link](place+" is an Invalid place");
}
}
}
This study source was downloaded by 100000841384095 from [Link] on 02-15-2022 03:25:30 GMT -06:00
[Link]
Powered by TCPDF ([Link])
publ
i
cclassAccount{
pri
vatel
ongaccountNumber;
pri
vatedoubl
ebalanceAmount
;
publ
i
cAccount (
longaccount
Number,doubl
ebal
anceAmount
){
thi
[Link] Number=account
Number;
thi
[Link]=balanceAmount;
}
publ
i
clonggetAccount
Number
(){
ret
urnaccount
Number;
}
publ
i
cv oidsetAccount
Number(l
ongaccountNumber
){
thi
[Link]=account
Number ;
}
publ
i
cdoublegetBal
anceAmount
(){
ret
urnbal
anceAmount;
}
publ
i
cv oidset
BalanceAmount
(doubl
ebalanceAmount
){
thi
[Link]
anceAmount=balanceAmount;
}
publ
i
cvoiddeposi
t(
doubl
edeposi
tAmount
){
bal
anceAmount+=deposi
tAmount
;
}
publ
i
cbool eanwi t
hdr
aw(doubl
ewithdr
awAmount
){
if(
withdrawAmount<=balanceAmount){
balanceAmount-=wit
hdrawAmount;
retur
nt r
ue;
}
r
etur
nfal
se;
}
}
i
mpor
tjav
[Link]
malFor
mat
;
i
mpor
tjav
[Link]
.Scanner
;
publ
i
cclassMai n{
publ
icstati
cv oi
dmai n(
Str
ing[
]args){
Scannerscanner=newScanner (
Syst
em.
i
n);
DecimalFor
matdecimalFormat=newDecimal
For
mat
("
0.00"
);
Syst
[Link]
.pri
ntl
n("
Ent
ert
heaccountnumber:
")
;
l
ongaccountNumber=scanner
.next
Long(
);
Syst
[Link].
pri
ntl
n("
Ent
eri
niti
albal
ance:
")
;
doubl
ebalanceAmount=scanner.
next
Doubl
e()
;
Accountaccount=newAccount
(account
Number
,bal
anceAmount
);
Sy
stem.
out
.pr
int
ln(
"Ent
ert
heamountt
obedeposi
ted:
")
;
doubledeposit
Amount=[Link]
Double()
;
account.
deposit
(deposi
tAmount)
;
doubleavai
labl
eBalance=account.
get
BalanceAmount
();
Sy
[Link]
.pr
int
ln(
"Av
ail
abl
e bal
ance i
s:" +
deci
mal
For
mat.f
ormat(
avail
abl
eBal
ance)
);
Syst
[Link]
ntl
n("
Ent
ertheamounttobewithdrawn:
")
;
doublewit
hdrawAmount=scanner .
next
Doubl
e();
bool
eanisWi t
hdrawn=account.
withdr
aw(wi
thdrawAmount
);
avai
labl
eBalance=account.
get
BalanceAmount(
);
i
f(!
isWithdr
awn){
Sy
[Link]
.pr
int
ln(
"I
nsuf
fi
cientbal
ance"
);
}
Sy
[Link]
.pr
int
ln(
"Av
ail
abl
e bal
ance i
s:" +
deci
mal
For
mat.f
ormat(
avail
abl
eBal
ance)
);
}
}
Software License Details
[Link]
<!--Do not make any change in this code template -->
<html>
<head>
<script src="[Link]" type="text/javascript"> </script>
</head>
<body>
<h2>Software License Details</h2>
<table>
<tr>
<td> Software Name</td>
<td><input type="text" id="softwareName" placeholder="Enter the software
name" required></td>
</tr>
<tr>
<td> Serial Key </td>
<td> <input type="text" id="serialKey" placeholder="Enter 12 digit alphanumeric
serial key" required></td>
</tr>
<tr>
<td> </td>
<td> <button id="validate" onclick=validate()>Validate</button> </td>
</tr>
</table>
<div id="result"></div>
</body>
</html>
[Link]
// Fill the code wherever necessary
function validate()
{
var softwareName=[Link]("softwareName").value;
var serialKey = [Link]("serialKey").value;
//var serialKey= //Fill your code here to get the value of element by using id "serialKey" and
store it in a variable "serialKey"
//HINT: use the above "softwareName" as a sample to get "serialKey"
function validateSerialKey(serialKey)
{
var pattern=/^[0-9a-zA-Z]{12}$/;
var isSerialKey = [Link](pattern);
return Boolean(isSerialKey);
// Fill your code here
// find if the serialKey is valid by checking if it matches the given pattern
// return true or false
<tr>
<td> </td>
<td> <button id="submit" onclick=validate()>Submit</button> </td>
</tr>
</table>
<div id="result"></div>
</body>
</html>
[Link]
// Fill the code wherever necessary
function validate()
{
var policyNumber=[Link]("policyNumber").value;
amount=[Link]("amount").value;
//var amount= //Fill your code here to get the value of element by using id "amount" and
store it in a variable "amount"
//HINT: use the above "policyNumber" as a sample to get "amount"
function validatePolicyNumber(policyNumber)
{
var pattern=/^[0-9]{7}$/;
if(!([Link](pattern)))
return false
else
return true;
}
Email Validation
[Link]
<!--Do not make any change in this code template -->
<html>
<head>
<script src="[Link]" type="text/javascript"> </script>
</head>
<body>
<h2>Registration form</h2>
<table>
<tr>
<td> Trainee Name</td>
<td><input type="text" id="traineeName" placeholder="Enter the trainee name"
required></td>
</tr>
<tr>
<td> Email ID </td>
<td> <input type="text" id="emailId" placeholder="Enter the email id"
required></td>
</tr>
<tr>
<td> </td>
<td> <button id="register" onclick=validate()>Register</button> </td>
</tr>
</table>
<div id="result"></div>
</body>
</html>
[Link]
// Fill the code wherever necessary
function validate()
{
var traineeName=[Link]("traineeName").value;
//var emailId= //Fill your code here to get the value of element by using id "emailId" and
store it in a variable "emailId"
//HINT: use the above "traineeName" as a sample to get "emailId"
var emailId = [Link]("emailId").value;
if(traineeName && emailId)
{
if(validateEmailId(emailId))
[Link]("result").innerHTML = "The email id : "+emailId+" is validated
successfully for the trainee "+traineeName;
else
[Link]("result").innerHTML = "Please, provide a valid email id";
}
else
[Link]("result").innerHTML = "Trainee name (or) email id missing";
}
function validateEmailId(emailId)
{
// Fill your code here to check whether the 'email' has '@' symbol and '.' symbol
// HINT : [Link]("@") will return true, if the emailId has '@' symbol.
// find whether email has both '@' and '.'
// Return true or false
if([Link]('@') && [Link]('.')){
return true;
}
return false;
Number Of Days
[Link]
<!--Do not make any change in this code template -->
<html>
<head>
<script src="[Link]" type="text/javascript"> </script>
</head>
<body>
<h2>Recharge Pack Validity</h2>
<table>
<tr>
<td> Recharge Pack Name</td>
<td><input type="text" id="rechargePackName" placeholder="Enter the recharge
pack name" required></td>
</tr>
<tr>
<td> Validity (in days) </td>
<td> <input type="number" id="validity" min="1" placeholder="Enter the validity
in days" required></td>
</tr>
<tr>
<td> </td>
<td> <button id="validate" onclick=validate()>Submit</button> </td>
</tr>
</table>
<div id="result"></div>
</body>
</html>
[Link]
// Fill the code wherever necessary
function validate()
{
var rechargePackName=[Link]("rechargePackName").value;
var validity=[Link]("validity").value;//Fill your code here to get the value
of element by using id "validity" and store it in a variable "validity"
//HINT: use the above "rechargePackName" as a sample to get "validity"
function validateRechargePackName(rechargePackName)
{
var pattern=/^[A-Z]{2}[0-9]{3}$/;
// Fill your code here
// find if the rechargePackName is valid by checking if it matches the given pattern
// return true or false
if([Link](pattern))
{
return true;
}
else
{
return false;
}
Frequency Calculation
[Link]
<!--Do not make any change in this code template -->
<html>
<head>
<script src="[Link]" type="text/javascript"> </script>
</head>
<body>
<h2>Frequency Calculator</h2>
<table>
<tr>
<td> Frequency Band</td>
<td><input type="text" id="band" placeholder="Enter the frequency band"
required></td>
</tr>
<tr>
<td> Wavelength in mm </td>
<td> <input type="number" id="wavelength" placeholder="0.1-1000" min="0.1"
max="1000" step="0.1" required></td>
</tr>
<tr>
<td> </td>
<td> <button id="submit" onclick=validate()>Submit</button> </td>
</tr>
<tr>
<td colspan="2">
* Acceptable frequency bands are H, M, L, U, S, C, X, K.
</td>
</tr>
</table>
<div id="result"></div>
</body>
</html>
[Link]
// Fill the code wherever necessary
function validate()
{
var band=[Link]("band").value;
var wavelength=[Link]("wavelength").value //Fill your code here to get
the value of element by using id "wavelength" and store it in a variable "wavelength"
//HINT: use the above "band" as a sample to get "wavelength"
function validateFrequencyBand(band)
{
var pattern=/^[H|M|L|U|S|C|X|K]$/;
// Fill your code here
// find if the band is valid by checking if it matches the given pattern
// return true or false
if([Link](pattern))
{
return true;
}
else
{
return false;
}
AC Maintenance Service-V1
[Link]
<!DOCTYPE html>
<html>
<head>
#submit, #reset {
/* Fill attributes and values */
font-weight: bold;
font-family: Candara;
background-color: #556B2F;
width:10em;
height:35px;
border-radius: 10px;
}
input {
width:13.6em;
}
#appointment {
font-family:sans-serif;
width:80%;
border-collapse:collapse;
text-align:left;
}
#acType, textarea{
width:13.6em;
}
select {
width:14em;
}
td{
padding:3px;
}
#male, #female, #yearlyMaintenance {
width:10pt;
}
.checkboxes label {
display: inline-block;
padding-right: 10px;
white-space: nowrap;
}
.checkboxes input {
vertical-align: middle;
}
.checkboxes label span {
vertical-align: middle;
}
</style>
</head>
<body>
<table id="appointment">
<tr>
<td> <label for = 'customerName'>Customer Name</label></td>
<td><input type='text' id = 'customerName' placeholder="Enter your name" required> </td>
</tr>
<tr>
<td> <label for = 'mobileNumber'>Mobile Number</label> </td>
<td> <input type ='tel' id ='mobileNumber' name ='Mobile Number' placeholder="Enter your
mobile number" pattern="^[7-9][0-9]{9}$" maxlength="10" minLength = '10' required> </td>
</tr>
<tr>
<td> <label for = 'address'>Address</label></td>
<td> <textarea id= 'address' name = 'address' placeholder="Enter your address" rows = '5' cols
='25' required></textarea> </td>
</tr>
<tr>
<td> <label for = 'acType'>AC Type</label> </td>
<td>
<select id="acType">
<option id="Split" value ="Split">Split</option>
<option id="Window" value ="Window">Window</option>
<option id = "Centralized" value = "Centralized">Centralized</option>
<option id='Portable' value ='Portable'>Portable</option>
</select>
</td>
</tr>
<tr>
<td> <label for ='serviceType'>Service Type</label> </td>
<td>
<input type="checkbox" name="serviceType" id="Cleaning" value="Cleaning" ><label for =
'Cleaning'> Cleaning</label>
<input type="checkbox" name="serviceType" id="Repair" value="Repair" ><label for =
'Repair'> Repair</label>
<input type="checkbox" name="serviceType" id="Gas Refill" value="Gas Refill" ><label for =
'Gas Refill'> Gas Refill</label>
<input type="checkbox" name="serviceType" id="Relocation" value="Relocation" ><label for
= 'Relocation'> Relocation</label>
<input type="checkbox" name="serviceType" id="Filter" value="Filter" ><label for = 'Filter'>
Filter</label>
</td>
</tr>
<tr>
<td> <label for = 'dateForAppointment'>Date for Appointment</label> </td>
<td> <input type ='date' id = 'dateForAppointment' required> </td>
</tr>
<tr>
<td> <label for ='yearlyMaintenance'>Yearly Maintenance</label> </td>
<td> <input type = 'checkbox' id = 'yearlyMaintenance' name = 'yearlyMaintenance'> <label
for = 'yearlyMaintenance'>Select if required</label></td>
</tr>
<tr>
<td> <!-- empty cell --></td>
<td>
<input type = 'submit' value = 'Submit' id = 'submit'>
<input type ='reset' value ='Clear' id = 'reset' >
</td>
</tr>
<tr>
<td colspan="2">
<div id="result"></div>
</td>
</tr>
</table>
</form>
</body>
</html>
[Link]
function getTotalService() {
var totalServices = [Link]("serviceType");
var count = 0;
for(var i=0; i<[Link]; i++) {
if(totalServices[i].checked) {
count++
}
}
return count;
}
function getServiceCost() {
var totalServices = [Link]("serviceType");
var totalCost = 0;
for(var i=0; i<[Link]; i++) {
if(totalServices[i].checked) {
switch(totalServices[i].value) {
case "Cleaning":
totalCost += 500;
break;
case "Repair":
totalCost += 2500;
break;
case "Gas Refill":
totalCost += 750;
break;
case "Relocation":
totalCost += 1500;
break;
case "Filter":
totalCost += 250;
break;
default:
break;
}
}
}
return totalCost;
}
function calculateDiscount(serviceCost) {
serviceCost = serviceCost*0.85;
return serviceCost;
}
function getYearlyMaintenanceCost() {
var yearlyMaintenance = [Link]("yearlyMaintenance");
if(yearlyMaintenance[0].checked)
return 1500;
else
return 0;
}
function bookAppointment() {
var totalNumberOfServices = getTotalService();
var serviceCost = 0;
if(totalNumberOfServices > 2) {
serviceCost = calculateDiscount(getServiceCost());
} else {
serviceCost = getServiceCost();
}
if(yearlyMaintenanceCost) {
[Link]("result").innerHTML = "Your booking for " + acType +
" AC service is successful!<br>The estimated service cost with maintenance is Rs." +
[Link](totalCost);
} else {
[Link]("result").innerHTML = "Your booking for " + acType +
" AC service is successful!<br>The estimated service cost is Rs." + [Link](totalCost);
}
input[type="text"] {
width: 97%;}
input[type="number"] {
width: 97%;}
input[type="tel"] {
width: 97%;}
body{
background-image:url('[Link]');
background-size: 100%;
font-weight: bold;
}
div{
font-size: 20px;
text-align: center;
color:#FFFFFF;
margin-left: auto;
margin-right: auto;
}
h3{
width: 50%;
color: #FFFFFF;
background-color: #000080;
margin-left: 25%;
margin-right: auto;
text-align: center;
font-family: Verdana;
padding: 5px;
border-radius: 6px;
}
::-webkit-input-placeholder {
color: #808080; }
#submit{
width: 50%;
color: #FFFFFF;
background-color: #000080;
margin-left: 25%;
margin-right: auto;
padding: 5px;
font-family: Verdana;
font-weight: bold;
border-radius: 6px;
}
</style>
</head>
<body>
<table>
<tr>
<td>Purchase Date</td>
<td><input type="text" id="pdate" onfocus="today()" required/></td>
</tr>
<tr>
<td>Customer Name</td>
<td><input type="text" id="cname" placeholder="Enter the customer name" pattern="[a-zA-
Z\s]+" required></td>
</tr>
<tr>
<td>Address</td>
<td><textarea placeholder="Enter the address" rows="4" cols="50" id="address"
required></textarea></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input type="tel" id="phno" placeholder="Phone number" pattern="[7|8|9]+[0-9]{9}"
required></td>
</tr>
<tr>
<td>Server Type</td>
<td><select id="stype" required>
<option value="Select Server Type..">Select Server Type..</option>
<option id= "Dedicated Server" value="Dedicated Server">Dedicated Server</option>
<option id="VPS" value="VPS">VPS</option>
<option id= "Storage Server" value="Storage Server">Storage
Server</option>
<option id="Database Server" value="Database Server">Database Server</option>
</select>
</td>
</tr>
<tr>
<td>CPU(Core)</td>
<td><select id="core" required>
<option value="Select no of cores..">Select no of cores..</option>
<option id="2 cores" value="2 cores">2 cores</option>
<option id="4 cores" value="4 cores">4 cores</option>
<option id="6 cores" value="6 cores">6 cores</option>
<option id="8 cores" value="8 cores">8 cores</option>
</select>
</td>
</tr>
<tr>
<td>Configuration</td>
<td><select id="configuration" required>
<option value="Select configuration..">Select configuration..</option>
<option id="4 GB RAM , 300 GB SSD-boosted Disk Storage" value="4 GB RAM , 300 GB SSD-
boosted Disk Storage">4 GB RAM , 300 GB SSD-boosted Disk Storage</option>
<option id="8 GB RAM , 700 GB SSD-boosted Disk Storage" value="8 GB RAM , 700 GB SSD-
boosted Disk Storage">8 GB RAM , 700 GB SSD-boosted Disk Storage</option>
<option id= "12 GB RAM , 1 TB SSD-boosted Disk Storage" value="12 GB RAM , 1
TB SSD-boosted Disk Storage">12 GB RAM , 1TB SSD-boosted Disk Storage</option>
</select>
</td>
</tr>
<tr>
<td>Payment Type</td>
<td><select id="ptype" required>
<option id="Card" value="Card">Debit card / Credit card</option>
<option id="Cash" value="Cash">Cash</option>
</select>
</td>
</tr>
</table>
<br/><br/>
<input type="submit" value="CONFIRM PURCHASE" id="submit" onclick="calculatePurchaseCost()">
<br/><br/>
<br/><br/>
<!--</form>-->
</body>
</html>
[Link]
function getCoreCost(core)
{
if([Link]("2"))
{
return 20000;
}
if([Link]("4"))
{
return 25000;
}
if([Link]("6"))
{
return 30000;
}
if([Link]("8"))
{
return 40000;
}
}
function getConfigurationCost(config)
{
if([Link]("4"))
{
return 5000;
}
if([Link]("8"))
{
return 10000;
}
if([Link]("1"))
{
return 15000;
}
}
function calculateTax(totalcost,ptype)
{
let tax,ex=0;
totalcost=parseInt(totalcost);
tax=totalcost*12/100;
if([Link]("Card"))
{
ex=(totalcost+tax)*2/100;
}
return [Link](totalcost+tax+ex);
function calculatePurchaseCost()
{
var core=[Link]('core').value;
var conf=[Link]('configuration').value;
var corecost=getCoreCost(core);
var confcost=getConfigurationCost(conf);
var totalcost=corecost+confcost;
var ptype=[Link]('ptype').value;
var tax=calculateTax(totalcost,ptype);
var server=[Link]('stype').value;
[Link]('result').innerHTML="Purchase of a "+server+" with "+conf+" has been
logged!<br>An amount of Rs."+tax+", inclusive of tax has been received by "+ptype;
}
input[type="number"] {
width:98%;
}
input[type="text"] {
width:98%;
}
input[type="date"] {
width: 98%;
}
input[type="email"] {
width:98%;
}
input[type="tel"] {
width: 98%;
}
select {
width: 98%;
}
body{
margin-left: auto;
margin-right: auto;
width: 60%;
background-size:60%;
}
form {
margin-left: auto;
margin-right: auto;
text-align: center;
width: 50%;
}
h1 {
background-color: #00cc66;
color: #FFFFFF;
font-family: Courier New;
font-style: italic;
text-align: center;
}
td, th {
border: 1px solid #ddd;
padding: 8px;
}
#main{
background-color: #9999ff;
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
color: #FFFFFF;
font-weight: bold;
padding-left: 10px;
padding-right: 10px;
}
#result{
font-size:20px;
font-weight:bold;
}
</style>
</head>
<body>
<div id="main">
<h1>Boat Ride Bill Automation</h1>
<form onsubmit="return bookRide()">
<table>
<tr>
<td>Customer Name</td>
<td><input type="text" id="cname" name="cname" placeholder="Customer
Name" /></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input type="tel" id="phno" name="phno" placeholder="Phone
Number" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" id="email" name="email" placeholder="Email" /></td>
</tr>
<tr>
<td>Number of Persons</td>
<td><input type="text" id="noOfPersons" name="noOfPersons"
placeholder="Number of Persons" required /></td>
</tr>
<tr>
<td>Boat Type</td>
<td><select id="btype" name="btype">
<option id="2seater" value="2 Seater Boat">2 Seater Pedal Boat</option>
<option id="4seater" value="4 Seater Boat">4 Seater Pedal Boat</option>
<option id="8seater" value="8 Seater Boat">8 Seater Motor Boat</option>
<option id="15seater" value="15 Seater Boat">15 Seater Motor Boat</option>
</select></td>
</tr>
<tr>
<td>Travel Duration in Hours</td>
<td><input type="number" id="duration" name="duration" /></td>
</tr>
</table>
<br>
<p><input type="submit" id="submit" name="submit" value="Book Ride"/></p>
<div id="result"></div>
</form>
</div>
<script src="[Link]"></script>
</body>
</html>
[Link]
function bookRide(){
var btype=[Link]("btype").value;
var noOfPersons=[Link]("noOfPersons").value;
var duration=[Link]("duration").value;
var boatCount=getBoatCount(btype,noOfPersons);
var boatPrice=getBoatPrice(btype,boatCount);
var cal=calculateBill(boatPrice,duration);
[Link]("result").innerHTML="You need to pay Rs."+cal;
}
function calculateBill(boatPrice,duration){
return boatPrice*duration;
}
function getBoatPrice(btype,boatCount){
if(btype=="2 Seater Boat"){
return (boatCount*240);
}
if(btype=="4 Seater Boat"){
return (boatCount*260);
}
if(btype=="8 Seater Boat"){
return (boatCount*560);
}
if(btype=="15 Seater Boat"){
return (boatCount*990);
}
}
function getBoatCount(btype,noOfPersons){
if(btype=="2 Seater Boat"){
if (noOfPersons%2===0){
return(parseInt(noOfPersons/2));
}
else{
return(parseInt(noOfPersons/2)+1);
}
}
if(btype=="4 Seater Boat"){
if (noOfPersons%4===0){
return(parseInt(noOfPersons/4));
}
else{
return(parseInt(noOfPersons/4)+1);
}
}
if(btype=="8 Seater Boat"){
if (noOfPersons%8===0){
return(parseInt(noOfPersons/8));
}
else{
return(parseInt(noOfPersons/8)+1);
}
}
if(btype=="15 Seater Motor Boat"){
if (noOfPersons%15===0){
return(parseInt(noOfPersons/15));
}
else{
return(parseInt(noOfPersons/15)+1);
}
}
}
Singapore Tourism-V1
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Singapore Tourism</title>
<style>
input[type="number"],input[type="text"],input[type="date"],input[type="email"],input[type=
"tel"],select {
width:95%;
}
body{
background-color: #993366;
font-weight: bold;
}
div{
margin-left: auto;
margin-right: auto;
text-align: center;
color: #FFFFFF;
font-size: 20px;
}
h3{
font-family: Verdana;
text-align: center;
border-radius: 6px;
margin-left: auto;
margin-right: auto;
background-color: #00ccff;
color: #FFFFFF;
width: 50%;
padding: 5px;
}
::-webkit-input-placeholder {
color: #696969;
font-weight: bold;
}
#submit{
color: #FFFFFF;
font-weight: bold;
font-family: Verdana;
background-color: #00ccff;
border-radius: 6px;
padding: 5px;
width: 50%;
margin-right: auto;
margin-left: auto;
}
#result{
color: #000000;
font-size: 20px;
}
</style>
</head>
<body>
<div>
<h3>Singapore Tourism</h3>
<form onsubmit="return calculateCost()">
<table border="1">
<tr>
<td> Name </td>
<td> <input type="text" id="name" required></td>
</tr>
<tr>
<td> Phone no </td>
<td> <input type="tel" id="phno" required></td>
</tr>
<tr>
<td> Email ID </td>
<td> <input type="email" id="email" required></td>
</tr>
<tr>
<td> Number of Persons </td>
<td> <input type="number" id="noOfPersons" required></td>
</tr>
<tr>
<td> Prefer Stay</td>
<td><input type="radio" id="yes" name="preferStay" value="Yes" required
onchange="disableNoOfDaysStay()">Yes
<input type="radio" id="no" name="preferStay" value="No" required
onchange="disableNoOfDaysStay()">No</td>
</tr>
<tr>
<td> Number of Days Stay </td>
<td> <input type="number" id="noOfDaysStay" required></td>
</tr>
<tr>
<td>Places you would like to visit</td>
<td>
<input type="checkbox" name="placesOfChoice" id="Pilgrimage"
value="Pilgrimage">Places Of Pilgrimage<br>
<input type="checkbox" name="placesOfChoice" id="Heritage"
value="Heritage">Places Of Heritage<br>
<input type="checkbox" name="placesOfChoice" id="Hills" value="Hills">Hills<br>
<input type="checkbox" name="placesOfChoice" id="Falls" value="Falls">Falls<br>
<input type="checkbox" name="placesOfChoice" id="Beach"
value="Beach">Beach<br>
<input type="checkbox" name="placesOfChoice" id="Adventures"
value="Adventures">Places Of Adventures
</td>
</tr>
</table>
<div id="result"></div>
</form>
</div>
<script src="[Link]" type="text/javascript"> </script>
</body>
</html>
[Link]
function getCount()
{
var count=0;
if([Link]("Pilgrimage").checked===true)
{
count+=1;
}
if([Link]("Heritage").checked===true)
{
count+=1;
}
if([Link]("Hills").checked===true)
{
count+=1;
}
if([Link]("Falls").checked===true)
{
count+=1;
}
if([Link]("Beach").checked===true)
{
count+=1;
}
if([Link]("Adventures").checked===true)
{
count+=1;
}
return count;
}
function getTotalCost(noOfpersons)
{
var initcost=0;
if([Link]("Pilgrimage").checked===true)
{
initcost+=350;
}
if([Link]("Heritage").checked===true)
{
initcost+=430;
}
if([Link]("Hills").checked===true)
{
initcost+=780;
}
if([Link]("Falls").checked===true)
{
initcost+=1200;
}
if([Link]("Beach").checked===true)
{
initcost+=270;
}
if([Link]("Adventures").checked===true)
{
initcost+=4500;
}
return initcost*noOfpersons;
}
function calculateDiscount(cost)
{
if(getCount()>=2)
{
return (cost*(85/100));
}
return 0;
}
function getStayCost(noOfPersons)
{
if([Link]("yes").checked===true)
{
var noOfDays=[Link]("noOfDaysStay").value;
return noOfPersons* noOfDays *150;
}
return 0;
}
function disableNoOfDaysStay()
{
if([Link]("no").checked===true)
{
[Link]("noOfDaysStay").setAttribute("disabled",true);
}
/*if([Link]("yes").checked===true)
{
[Link]("noOfDaysStay").setAttribute("disabled",false);
}*/
}
function calculateCost()
{
var noOfPersons=[Link]("noOfPersons").value;
var totalcost=getTotalCost(noOfPersons);
var discount=calculateDiscount(totalcost);
var staycost=getStayCost(noOfPersons);
var packagecost=discount+staycost;
var res=packagecost+936;
[Link]("result").innerHTML="Your preferred package cost "+res+"$";
return false;
}
Monthly Instalment Estimator-V1
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Monthly Instalment Estimator</title>
<style>
input[type="number"] {
width:98%;
}
input[type="text"] {
width:98%;
}
input[type="date"] {
width: 98%;
}
input[type="email"] {
width:98%;
}
input[type="tel"] {
width: 98%;
}
select {
width: 98%;
}
body{
background-color:#FFAACC;
}
div{
margin-left: auto;
margin-right: auto;
text-align: center;
color: #FFFFFF;
font-size: 20px;
}
h3{
font-family: Verdana;
text-align: center;
border-radius: 6px;
margin-left: auto;
margin-right: auto;
background-color: #770080;
color: #FFFFFF;
width: 50%;
padding: 5px;
}
table, td, tr{
margin-left: auto;
margin-right: auto;
border: solid 2px black;
border-spacing: 1px;
border-radius: 6px;
width: 50%;
padding: 1px;
color: #000099;
background-color: #F2F2F2 ;
}
::-webkit-input-placeholder {
color: #696969;
font-weight: bold;
}
#submit{
margin-right: auto;
margin-left: auto;
color: #FFFFFF;
font-weight: bold;
font-family: Verdana;
background-color: #770080;
text-align:center;
border-radius: 6px;
padding: 5px;
width: 50%;
}
#result{
color: #770080;
font-size: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<div>
<h3>Monthly Instalment Estimator</h3>
<form onsubmit="return availLoan()">
<table>
<tr>
<td>Applicant Name</td>
<td><input type="text" id="aname" name="aname" placeholder="Applicant Name"
required /></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input type="tel" id="phno" name="phno" placeholder="Phone Number"
required /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" id="email" name="email" placeholder="Email" required
/></td>
</tr>
<tr>
<td>Aadhar Number</td>
<td><input type="text" id="aadhar" name="aadhar" placeholder="Aadhar Number"
required /></td>
</tr>
<tr>
<td>Pan Number</td>
<td><input type="text" id="pan" name="pan" placeholder="Pan Number" required
/></td>
</tr>
<tr>
<td>Monthly Income</td>
<td><input type="text" id="income" name="income" placeholder="Monthly
Income" required /></td>
</tr>
<tr>
<td>Loan Type</td>
<td><select name="loanType" id="loanType">
<option id="home" value="Home Loan">Home Loan</option>
<option id="personal" value="Personal Loan">Personal Loan</option>
<option id="vehicle" value="Vehicle Loan">Vehicle Loan</option>
</select></td>
</tr>
<tr>
<td>Expected Loan Amount</td>
<td><input type="number" id="expectedAmt" name="expectedAmt" required
/></td>
</tr>
<tr>
<td>Tenure In Months</td>
<td><input type="number" id="tenure" name="tenure" required /></td>
</tr>
</table>
<br>
<p><input type="submit" id="submit" name="submit" value="Avail Loan"/></p>
<div id="result"></div>
</form>
</div>
<script src="[Link]" type="text/javascript"> </script>
</body>
</html>
[Link]
function calculateEMI (income, expectedAmt, tenure, interestRatePerAnnum)
{
var EMI, R, N;
R=(interestRatePerAnnum/100)/12;
N=tenure;
EMI= (expectedAmt*R*([Link]((1+R),N))/([Link]((1+R),N)-1)).toFixed(2);
return [Link](EMI);
}
function getInterestRate(loanType)
{
var intre;
if(loanType=="Home Loan")
{
intre=7;
}
else if(loanType=="Personal Loan")
{
intre=7.8;
}
else if(loanType=="Vehicle Loan")
{
intre=15;
}
return intre;
}
function checkEligibility(income,emi)
{
var tmp;
tmp=income*60/100;
if(emi<=tmp)
{
return true;
}
else
{
return false;
}
}
function availLoan()
{
var lt,ltt;
ltt=[Link]("loanType");//
lt=[Link][[Link]].value;//
var irpa;
irpa=parseFloat(getInterestRate(lt));
if(elig===true)
{
[Link]("result").innerText="You are eligible to get a loan amount as
"+expectedLoanAmount+"and emi per month is "+emival;
}
else
{
[Link]("result").innerText="You are not eligible";
}
return false;
}
Automatic evaluation[+]
[Link]
1 using System;
2 using [Link];
3 using [Link];
4 using [Link];
5 using [Link];
6 using [Link];
7 using [Link];
8 using [Link];
9 using [Link];
10
11 namespace TicketManagement //DO NOT change the namespace name
12 {
13 public class Program //DO NOT change the class name
14 {
15
16 static void Main(string[] args) //DO NOT change the 'Main' method signature
17 {
18 //Implement the code here
19 char choice = 'y';
20 [Link]("Enter Ticket Details: ");
21 while( choice == 'y')
22 {
23 [Link]("Enter Passenger Id:");
24 string id = [Link]();
25 [Link]("Enter Passenger Name:");
26 string name = [Link]();
27 [Link]("Enter Travel Date:");
28 string date = [Link]();
29 [Link]("Enter Distance Travelled:");
30 int dist = Convert.ToInt32([Link]());
31 DistanceValidator dv = new DistanceValidator();
32 while ( [Link](dist) == "true")
33 {
34 [Link]("Given distance is invalid");
35 [Link]("Enter Distance Travelled: ");
36 dist = Convert.ToInt32([Link]());
37 }
38 TicketDetail td = new TicketDetail(id, name, date, dist);
39 TicketBooking tb = new TicketBooking();
40 [Link](td);
41 [Link](td);
42 [Link]([Link]);
43 [Link]([Link]);
44 [Link]([Link]);
45 [Link]([Link]);
46 [Link]($"Ticket Cost : {[Link]}");
47 [Link]("Book Another Ticket (y/n): ");
48 choice =[Link]([Link]());
49 }
50 }
51 }
52 public class DistanceValidator
53 { //DO NOT change the class name
54
55 public String ValidateTravelDistance(int distance) //DO NOT change the method signature
56 {
57 //Implement code here
58 if(distance < 0)
59 {
60 return "Given distance is invalid";
61 }
62 else
63 {
64 return "";
65 }
66 }
67 }
68 }
69
[Link]
1 <!-- THIS IS FOR REFERENCE ONLY. YOU ARE NOT REQUIRED TO MAKE ANY CHANGES HERE -->
2
3 <?xml version="1.0" encoding="utf-8" ?>
4 <configuration>
5 <startup>
6 <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
7 </startup>
8 <connectionStrings>
9 <add name="SqlCon"
connectionString="server=localhost;database=TicketBookingDB;uid=XXXXX;password=XXXXXX;"/>
10 </connectionStrings>
11 </configuration>
[Link]
1 using System;
2 using [Link];
3 using [Link];
4 using [Link];
5 using [Link];
6 using [Link];
7 using [Link];
8
9 namespace TicketManagement //DO NOT change the namespace name
10
11 {
12 public class DBHandler //DO NOT change the class name
13 {
14 //Implement the methods as per the description
15 public DBHandler() { }
16
17 public SqlConnection GetConnection()
18 {
19 return new SqlConnection([Link]["SqlCon"].ConnectionString);
20
21 }
22
23 }
24 }
25
[Link]
1 using System;
2 using [Link];
3 using [Link];
4 using [Link];
5 using [Link];
6 using [Link];
7 using [Link];
8 using [Link];
9
10 namespace TicketManagement //DO NOT change the namespace name
11 {
12 public class TicketBooking //DO NOT change the class name
13 {
14 //Implement the property as per the description
15 public SqlConnection Sqlcon { get; set; }
16
17 public TicketBooking() { }
18 DBHandler d = new DBHandler();
19 public void AddTicket(TicketDetail detail)
20 {
21
22 string query = "INSERT INTO TicketBooking VALUES(@id,@name,@date,@dist,@cost)";
23 using (SqlConnection con = [Link]())
24 using (SqlCommand cmd = new SqlCommand(query, con))
25 {
26 [Link]("@id", [Link]).Value = [Link];
27 [Link]("@name", [Link]).Value = [Link];
28 [Link]("@date", [Link]).Value = [Link];
29 [Link]("@dist", [Link]).Value = [Link];
30 [Link]("@cost", [Link]).Value = [Link];
31 [Link]();
32
33 try
34 {
35 [Link]();
36 }
37 catch (Exception e)
38 {
39 [Link]([Link]);
40 }
41 finally
42 {
43 [Link]();
44 }
45 }
46 }
47
48 //Implement the methods as per the description
49 public void CalculateCost(TicketDetail detail)
50 {
51 if([Link] <= 100)
52 {
53 [Link] = [Link] * 1;
54 }
55 else if([Link] >100 && [Link] <= 300)
56 {
57 [Link] = [Link] * 1.5;
58 }
59 else if ([Link] > 300 && [Link] <= 500)
60 {
61 [Link] = [Link] * 2.5;
62 }
63 else if ([Link] > 500)
64 {
65 [Link] = [Link] * 4.5;
66 }
67 }
68
69 }
70 }
71
[Link]
1 using System;
2 using [Link];
3 using [Link];
4 using [Link];
5 using [Link];
6
7 namespace TicketManagement //DO NOT change the namespace name
8{
9 public class TicketDetail //DO NOT change the class name
10 {
11 //Implement the fields and properties as per description
12
13 private string passengerId;
14 private string passengerName;
15 private string travelDate;
16 private int distanceTravel;
17 private double ticketCost;
18
19 public string PassengerId
20 {
21 get { return passengerId; }
22 set { [Link] = value; }
23 }
24 public string PassengerName
25 {
26 get { return passengerName; }
27 set { [Link] = value; }
28 }
29 public string TravelDate
30 {
31 get { return travelDate; }
32 set { [Link] = value; }
33 }
34 public int DistanceTravel
35 {
36 get { return distanceTravel; }
37 set { [Link] = value; }
38 }
39 public double TicketCost
40 {
41 get { return ticketCost; }
42 set { [Link] = value; }
43 }
44
45
46 public TicketDetail() { }
47 public TicketDetail(string passengerId, string passengerName, string travelDate, int distanceTravel)
48 {
49 [Link] = passengerId;
50 [Link] = passengerName;
51 [Link] = travelDate;
52 [Link] = distanceTravel;
53
54 }
55 }
56
57 }
58
Grade
Reviewed on Friday, 7 January 2022, 7:32 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
A New You Spa
[Link]
super(customerId,customerName,mobileNumber,memberType,emailId);
/*[Link] = customerId;
[Link] = customerName;
[Link] = mobileNumber;
[Link] = memberType;
[Link] = emailId;*/
boolean b=true;
String s1 = [Link]();
String regex="[DIAMOND]{7}[0-9]{3}";
if([Link](regex)){
b=true;
else{
b=false;
return b;
}
double discount=purchaseAmount*0.45;
double updateamount=purchaseAmount-discount;
return updateamount;
[Link]
super(customerId,customerName,mobileNumber,memberType,emailId);
boolean b=true;
String s1 = [Link]();
String regex="[GOLD]{4}[0-9]{3}";
if([Link](regex)){
b=true;
else{
b=false;
return b;
double discount=purchaseAmount*0.15;
double updateamount=purchaseAmount-discount;
return updateamount;
[Link]
return customerId;
[Link] = customerId;
return customerName;
[Link] = customerName;
}
return mobileNumber;
[Link] = mobileNumber;
return memberType;
[Link] = memberType;
return emailId;
[Link] = emailId;
[Link] = customerId;
[Link] = customerName;
[Link] = mobileNumber;
[Link] = memberType;
[Link] = emailId;
[Link]
public class PlatinumMembers extends Members {
super(customerId,customerName,mobileNumber,memberType,emailId);
/*customerId = customerId;
customerName = customerName;
mobileNumber = mobileNumber;
memberType = memberType;
emailId = emailId;
*/
boolean b=true;
String s1 = [Link]();
String regex="[PLATINUM]{8}[0-9]{3}";
if([Link](regex)){
b=true;
else{
b=false;
return b;
double updateamount=purchaseAmount-discount;
return updateamount;
[Link]
import [Link];
String cid=[Link]();
String cname=[Link]();
long mob=[Link]();
[Link]();
String mem=[Link]();
String email=[Link]();
double amount=[Link]();
if([Link]()){
res= [Link](amount);
[Link]("Name :"+[Link]());
[Link]("Id :"+[Link]());
[Link]("Email Id :"+[Link]());
} else if([Link]()){
res= [Link](amount);
[Link]("Name :"+[Link]());
[Link]("Id :"+[Link]());
[Link]("Email Id :"+[Link]());
} else if([Link]()){
res= [Link](amount);
[Link]("Name :"+[Link]());
[Link]("Id :"+[Link]());
[Link]("Email Id :"+[Link]());
} else{
Batting Average
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
[Link](new ArrayList<>());
boolean flag=true;
while(flag)
[Link]("3. Exit");
int choice=[Link]();
switch(choice)
case 1: {
int runScored=[Link]();
[Link](runScored);
break;
case 2: {
[Link]([Link]());
break;
case 3: {
flag=false;
break;
[Link]
package [Link];
import [Link];
return scoreList;
[Link] = scoreList;
}
//This method should add the runScored passed as the argument into the scoreList
[Link](runScored);
/* This method should return the average runs scored by the player
Average runs can be calculated based on the sum of all runScored available in the scoreList
divided by the number of elements in the scoreList.
For Example:
List contains[150,50,50]
*/
if([Link]()) {
return 0.0;
int size=[Link]();
int totalScore=0;
totalScore+=score;
}
return (double) totalScore / (double) size;
[Link]
import [Link].*;
String a = [Link]();
if([Link]() < 3) {
return;
return;
int j = 0;
arr1[j++] = arr[i];
if(j!=0) {
[Link]("String should not contain ");
[Link](arr1[i]);
return;
char b = [Link]().charAt(0);
int present = 0;
if(arr[i] == [Link](b)) {
arr[i] = [Link](b);
present = 1;
arr[i] = [Link](b);
present = 1;
if(present == 0) {
else {
[Link](arr[i]);
[Link]
public interface NumberType
[Link]
import [Link];
int n=[Link]();
if(isOdd().checkNumberType(n))
[Link](n+" is odd");
else
ChequePaymentProcess
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
connection=[Link]();
PreparedStatement statement=null;
ResultSet resultSet=null;
try {
statement=[Link]("select * from
cheque_payments");
resultSet=[Link]();
while([Link]()){
[Link]([Link]("customerNumber"));
[Link]([Link]("chequeNumber"));
[Link]([Link]("paymentDate"));
[Link]([Link]("amount"));
[Link](payment);
} catch (SQLException e) {
[Link]();
}finally{
try{
[Link]();
[Link]();
}catch(Exception e){
[Link]();
return paymentList;
[Link]
package [Link];
import [Link];
[Link] = customerNumber;
return chequeNumber;
[Link] = chequeNumber;
return paymentDate;
[Link] = paymentDate;
return amount;
[Link] = amount;
}
@Override
[Link]
package [Link];
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
List<Payment> list=[Link]();
list2 = [Link]().filter(x-
>[Link]()==customerNumber).collect([Link]());
return list2;
}
List<Payment> list=[Link]();
list2 = [Link]().filter(x->[Link]().getYear()==(year-
1900)).sorted([Link](Payment::getAmount)).collect([Link]());
return list2;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
public SkeletonValidator(){
validateClassName("[Link]");
validateMethodSignature("getAllRecord:[Link]","[Link]
ntDao");
validateClassName("[Link]");
validateMethodSignature("toString:[Link]","[Link]
ent");
validateClassName("[Link]");
validateMethodSignature("findCustomerByNumber:[Link],findCustomerByYear:[Link]
[Link]","[Link]");
validateClassName("[Link]");
validateMethodSignature("getConnection:[Link]","[Link]
[Link]");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
[Link]([Link],
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if
(!([Link]().getName().equals(returnType))) {
errorFlag = true;
} else {
if (!foundMethod) {
errorFlag = true;
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
private DatabaseUtil() {
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
try{
[Link](fis);
try {
[Link]([Link]("DB_DRIVER_CLASS"));
} catch (ClassNotFoundException e) {
[Link]();
try {
con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),p
[Link]("DB_PASSWORD"));
} catch (SQLException e) {
[Link]();
catch(IOException e){
[Link]();
return con;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
Payment payment=null;
do{
[Link]("Select Option:");
int choice=[Link]();
switch(choice){
int number=[Link]();
List<Payment> numberList=new
PaymentService().findCustomerByNumber(number);
if([Link]()==0){
[Link]("%15s%15s%15s%15s\n","Customer Number","Cheque
Number","Payment Date","Amount");
[Link]()
.forEach([Link]::println);
break;
int year=[Link]();
if([Link]()==0){
}else{
[Link]("%15s%15s%15s%15s\n","Customer Number","Cheque
Number","Payment Date","Amount");
[Link]()
.forEach([Link]::println);
break;
case 3:[Link](0);
default:[Link]("\nWrong Choice\n");
}while(true);
Passenger Amenity
[Link]
import [Link];
int num,n,i,count1=0,count2=0,y;
char alpha,ch;
String n1,n2;
n=[Link]();
if(n<=0){
[Link](0);
for(i=0;i<n;i++,count1=0,count2=0){
arr1[i] =[Link]();
arr2[i]= [Link]();
num =[Link](arr2[i].substring(1,(arr2[i].length())));
alpha= arr2[i].charAt(0);
count2++;
for(ch=65;ch<84;ch++){
if(ch==alpha){
count1++;
if(count1==0){
if(count2==0){
[Link](0);
for(i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(arr2[i].charAt(0)==arr2[j].charAt(0)){
if(([Link](arr2[i].substring(1,(arr2[i].length()))))<([Link](arr2[j].substring(1,arr2[j]
.length())))){
n1=arr1[i];
n2=arr2[i];
arr1[i]=arr1[j];
arr2[i]=arr2[j];
arr1[j]=n1;
arr2[j]=n2;
else
if(arr2[i].charAt(0)<arr2[j].charAt(0))
n1=arr1[i];
n2=arr2[i];
arr1[i]=arr1[j];
arr2[i]=arr2[j];
arr1[j]=n1;
arr2[j]=n2;
}
}
for(i=0;i<n;i++){
String a=arr1[i].toUpperCase();
String b=arr2[i];
[Link](a+" "+b);
[Link]("");
ExamScheduler
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link];
if(assessments==null || [Link]()) {
int rowsCount = 0;
try{
for(Assessment a:assessments)
[Link](1,[Link]());
[Link](2,[Link]());
[Link](3,[Link]().toString());
[Link](4,[Link]().toString());
[Link](5,[Link]().toString());
[Link](6,[Link]().toString());
int rs=[Link]();
if(rs!=-1)
rowsCount=rowsCount+1;
} catch(SQLException e){
return rowsCount;
PreparedStatement ps = [Link](sql);
[Link](1, code);
ResultSet rs = [Link]();
if([Link]()) {
[Link]([Link](1));
[Link]([Link](2));
[Link]([Link]([Link](3)));
[Link]([Link]([Link](4)));
[Link]([Link]([Link](5)));
[Link]([Link]([Link](6)));
return assessment;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
String temp[]=[Link](",");
Assessment a = new
Assessment(temp[0],temp[1],[Link](temp[2]),[Link](temp[3]),[Link](te
mp[4]),[Link](temp[5]));
return a;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
Period evalDays) {
super();
[Link] = examCode;
[Link] = examTitle;
[Link] = examDate;
[Link] = examTime;
[Link] = examDuration;
[Link] = evalDays;
public Assessment() {
return examCode;
[Link] = examCode;
return examTitle;
[Link] = examTitle;
return examDate;
[Link] = examDate;
}
return examTime;
[Link] = examTime;
return examDuration;
[Link] = examDuration;
return evalDays;
[Link] = evalDays;
DateTimeFormatter date1=[Link]("dd-MMM-y");
DateTimeFormatter date2=[Link]("HH:mm");
LocalTime t=[Link](examDuration);
String d=[Link]("HH:mm").format(t);
LocalDate t1=[Link](evalDays);
String d1=[Link]("dd-MMM-y").format(t1);
[Link]("Title: "+examTitle);
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
[Link](fis);
[Link]([Link]("DB_DRIVER_CLASS"));
con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),p
[Link]("DB_PASSWORD"));
catch(IOException e){
[Link]();
return con;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link].*;
import [Link];
import [Link];
String line="";
list=new ArrayList<Assessment>();
while((line=[Link]())!=null)
[Link]([Link](line));
return list;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
try {
[Link](assessments);
[Link]();
} catch (Exception e) {
[Link](e);
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public SkeletonValidator() {
[Link] };
testClass(assessmentClass, assessmentParams);
testClass(assessmentDAOClass, null);
testClass(funtionalClass, null);
testClass(databaseUtilClass, null);
testClass(fileUtilClass, null);
testFields(assessmentClass, assessmentFields);
try {
[Link](constructor);
} catch (ClassNotFoundException e) {
} catch (NoSuchMethodException e) {
} catch (SecurityException e) {
[Link]([Link],
try {
[Link](field);
} catch (ClassNotFoundException e) {
} catch (NoSuchFieldException e) {
[Link]([Link],
} catch (SecurityException e) {
[Link]([Link],
try {
[Link]([Link], " You have changed the " + "return type in '"
+ methodName
}
[Link](methodName + " signature is valid.");
} catch (ClassNotFoundException e) {
} catch (NoSuchMethodException e) {
} catch (SecurityException e) {
[Link]([Link],
[Link]
import [Link];
import [Link];
import [Link];
for(int i=0;i<[Link];i++)
str[i]=[Link]();
for(int i=0;i<[Link];i++)
String s[]=str[i].split(":");
m[i]=new Member(s[0],s[1],s[2]);
[Link](m[i]);
int tot1=[Link]();
for(int i=0;i<tot1;i++)
String s1=[Link]();
t1[i]=new ZEEShop(s1,mList);
t1[i].start();
//[Link](s1+" "+[Link]());
}
try {
[Link]().sleep(2000);
} catch (InterruptedException e) {
[Link]();
for(ZEEShop s:t1)
[Link]([Link]()+":"+[Link]());
[Link]
return memberId;
[Link] = memberId;
return memberName;
}
public void setMemberName(String memberName) {
[Link] = memberName;
return category;
[Link] = category;
super();
[Link] = memberId;
[Link] = memberName;
[Link] = category;
[Link]
import [Link];
[Link] = memberCategory;
[Link] = memberList;
return memberCategory;
[Link] = memberCategory;
return count;
[Link] = count;
}
public List<Member> getMemberList() {
return memberList;
[Link] = memberList;
synchronized(this)
for(Member m:memberList)
if([Link]().equals(memberCategory))
count++;
[Link]
public class FamilyInsurancePolicy extends InsurancePolicies{
int count=0;
if([Link]("FAMILY"));
count++;
char ch[]=[Link]();
for(int i=6;i<9;i++)
count++;
if(count==4)
return true;
else
return false;
double amount=0;
amount=2500*months*no_of_members;
amount=5000*months*no_of_members;
else if (age>=60)
amount=10000*months*no_of_members;
return amount;
[Link]
int count=0;
if([Link]("SINGLE"));
count++;
char ch[]=[Link]();
for(int i=6;i<9;i++)
count++;
if(count==4)
return true;
else
return false;
}
public double calculateInsuranceAmount(int months)
double amount=0;
amount=2500*months;
amount=5000*months;
else if (age>=60)
amount=10000*months;
return amount;
[Link]
return clientName;
[Link] = clientName;
return policyId;
return age;
[Link] = age;
return mobileNumber;
[Link] = mobileNumber;
return emailId;
[Link] = emailId;
super();
[Link] = clientName;
[Link] = policyId;
[Link] = age;
[Link] = mobileNumber;
[Link] = emailId;
[Link]
public class SeniorCitizenPolicy extends InsurancePolicies{
int count=0;
if([Link]("SENIOR"));
count++;
char ch[]=[Link]();
for(int i=6;i<9;i++)
count++;
if(count==4)
return true;
else
return false;
double amount=0;
amount=0;
else if (age>=60)
amount=10000*months*no_of_members;
return amount;
}
[Link]
import [Link];
String name=[Link]();
String id=[Link]();
int age=[Link]();
long mnum=[Link]();
String email=[Link]();
int month=[Link]();
double amount=0;
if([Link]("SINGLE"))
IndividualInsurancePolicy g=new
IndividualInsurancePolicy(name,id,age,mnum,email);
if([Link]())
//[Link]([Link]());
amount=[Link](month);
[Link]("Name :"+name);
[Link]("Email Id :"+email);
else
else if([Link]("FAMILY"))
FamilyInsurancePolicy g=new
FamilyInsurancePolicy(name,id,age,mnum,email);
if([Link]())
int num=[Link]();
amount=[Link](month,num);
[Link]("Name :"+name);
[Link]("Email Id :"+email);
}
else
else if([Link]("SENIOR"))
if([Link]())
int num=[Link]();
amount=[Link](month,num);
[Link]("Name :"+name);
[Link]("Email Id :"+email);
else
else
}
The Next Recharge Date
[Link]
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link]("Recharged date");
String date=[Link]();
String currentDate="29/10/2019";
if([Link](date)&&([Link](date,currentDate))){
[Link]("Validity days");
int days=[Link]([Link]());
if(days>0)
[Link]([Link](date,days));
else
else
String regex="^(3[01]|[12][0-9]|0[1-9])/(1[0-2]|0[1-9])/[0-9]{4}$";
Pattern pattern=[Link](regex);
Matcher matcher=[Link]((CharSequence)date);
return [Link]();
Date d1=[Link](date1);
Date d2=[Link](date2);
if(([Link](d2)<0)||([Link](d2)==0))
return true;
else
return false;
Calendar c=[Link]();
try{
Date mydate=[Link](date);
[Link](mydate);
[Link]([Link], days);
}catch(ParseException e){
[Link]();
String toDate=[Link]([Link]());
return toDate;
TravelRequestSystem
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link].*;
//import [Link];
import [Link];
class DB{
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
try{
[Link](fis);
[Link]([Link]("DB_DRIVER_CLASS"));
// create the connection now
con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),p
[Link]("DB_PASSWORD"));
catch(IOException e){
[Link]();
return con;
/**
* @return list
*/
try{
Connection con=[Link]();
PreparedStatement ps=[Link](query);
[Link](1,sourceCity);
[Link](2,destinationCity);
ResultSet rs=[Link]();
while([Link]()){
String tid=[Link]("travelReqId");
[Link] date=[Link]("travelDate");
String apstat=[Link]("approvalStatus");
String sour=[Link]("sourceCity");
String des=[Link]("destinationCity");
double cost=[Link]("travelCost");
[Link](tr);
catch(ClassNotFoundException e){
[Link]();
catch(SQLException e ){
[Link]();
/**
* @return list
*/
double amount=0;
try{
Connection con=[Link]();
PreparedStatement ps1=[Link](query);
[Link](1,approvalStatus);
ResultSet rs1=[Link]();
while([Link]()){
amount+=[Link]("travelCost");
catch(ClassNotFoundException e){
[Link]();
catch(SQLException e){
[Link]();
[Link]
package [Link];
import [Link].*;
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
String sourceCity=[Link]();
String destinationCity=[Link]();
String status=[Link]();
if([Link](sourceCity,destinationCity).equals("valid")){
if([Link]()){
else{
for(TravelRequest t:ltr){
String d=[Link]([Link]());
[Link]([Link]()+"\t| "+d+"\t|
"+[Link]()+"\t| "+[Link]()+"\t| "+[Link]()+"\t|
"+[Link]());
else{
if([Link](status).contentEquals("valid")){
[Link]([Link](status));
}
else{
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @return status
*/
if([Link]("Approved")||[Link]("Pending")){
return "valid";
}
/**
* @return status
*/
if(){
if([Link]("Pune")|| [Link]("Mumbai")||
[Link]("Chennai")|| [Link]("Bangalore")||
[Link]("Hydrabad")){
if([Link]("Pune")||
[Link]("Mumbai")||[Link]("Chennai")||
[Link]("Bangalore")|| [Link]("Hydrabad")){
return "valid";
else{
return "invalid";
else{
return "invalid";
else{
return "invalid";
/**
*
* @return listOfTravelRequest
*/
if([Link](sourceCity,destinationCity).contentEquals("valid")){
return [Link](sourceCity,destinationCity);
else{
return null;
/**
* @return totalCost
*/
if([Link](approvalStatus).equals("valid")){
return [Link](approvalStatus);
else{
return -1;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author t-aarti3
* This class is used to verify if the Code Skeleton is intact and not
* */
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"validateApprovalStatus:[Link],validateSourceAndDestination:[Link],getT
ravelDetails:[Link],calculateTotalTravelCost:double",
"[Link]");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
[Link]([Link],
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if
(!([Link]().getName().equals(returnType))) {
errorFlag = true;
} else {
if (!foundMethod) {
errorFlag = true;
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
[Link]
package [Link];
import [Link];
// member variables
public TravelRequest() {
super();
// parameterized constructor
super();
[Link] = travelReqId;
[Link] = travelDate;
[Link] = approvalStatus;
[Link] = sourceCity;
[Link] = destinationCity;
[Link] = travelCost;
// setter, getter
/**
*/
return travelReqId;
/**
* @param travelReqId
*/
[Link] = travelReqId;
/**
*/
return travelDate;
/**
* @param travelDate
*/
[Link] = travelDate;
}
/**
*/
return approvalStatus;
/**
* @param approvalStatus
*/
[Link] = approvalStatus;
/**
*/
return sourceCity;
/**
* @param sourceCity
*/
[Link] = sourceCity;
/**
*/
return destinationCity;
}
/**
* @param destinationCity
*/
[Link] = destinationCity;
/**
*/
return travelCost;
/**
* @param travelCost
*/
[Link] = travelCost;
}
AirVoice - Registration
[Link]
return customerName;
[Link] = customerName;
return contactNumber;
[Link] = contactNumber;
return emailId;
}
public void setEmailId(String emailId) {
[Link] = emailId;
return age;
[Link] = age;
[Link]
import [Link];
String name=([Link]());
long no=[Link]();
[Link]();
String mail=[Link]();
[Link]("Enter the Age:");
int age=[Link]();
[Link](name);
[Link](no);
[Link](mail);
[Link](age);
[Link]("Name:"+[Link]());
[Link]("ContactNumber:"+[Link]());
[Link]("EmailId:"+[Link]());
[Link]("Age:"+[Link]());
Alliteration
import [Link].*;
int count=0;
char aletter=[Link]().charAt(0);
char acon=[Link](aletter);
[Link]();
String sentence_letter=[Link]();
String cons=sentence_letter.toLowerCase();
for(int i=0;i<[Link]();i++)
ch[i]=[Link](i);
count++;
[Link](count);
if(count>3)
else if(count == 3)
[Link]("No score");
import [Link];
public class Main {
int n1 = 0;
int n2 = 0;
if(size<5||size>10)
return;
for(int i=0;i<size;i++)
a[i]=[Link]();
for(int i=0;i<size;i++)
if(i+2<size)
x[i]=[Link](a[i]-a[i+2]);
if(x[i]>max)
max=x[i];
n1=a[i];
n2=a[i+2];
else
continue;
int min=0;
if(n1>n2)
min=n2;
else
min=n1;
for(int i=0;i<size;i++)
if(a[i]==min)
[Link](i);
break;
[Link]
return advertisementId;
[Link] = advertisementId;
return priority;
[Link] = priority;
return noOfDays;
[Link] = noOfDays;
}
public String getClientName() {
return clientName;
[Link] = clientName;
super();
[Link] = advertisementId;
[Link] = priority;
[Link] = noOfDays;
[Link] = clientName;
ImageAdvertisement
[Link] = inches;
return inches;
}
public void setInches(int inches) {
[Link] = inches;
@Override
float baseAdvertisementCost=baseCost*inches*noOfDays;
float boosterCost=0f;
float serviceCost=0f;
if([Link]("high")){
boosterCost+=baseAdvertisementCost*0.1f;
serviceCost+=1000;
else if([Link]("medium")){
boosterCost+=baseAdvertisementCost*0.07f;
serviceCost+=700;
else if([Link]("low")){
serviceCost+=200;
return baseAdvertisementCost+boosterCost+serviceCost;
}
}
[Link]
import [Link];
int id=[Link]();
String priority=[Link]();
int noOfDays=[Link]();
[Link]();
String clientName=[Link]();
String type=[Link]();
if([Link]("video")){
int duration=[Link]();
VideoAdvertisement ad1=new
VideoAdvertisement(id,priority,noOfDays,clientName,duration);
float baseCost=(float)[Link]();
else if([Link]("image")){
int inches=[Link]();
ImageAdvertisement ad1=new
ImageAdvertisement(id,priority,noOfDays,clientName,inches);
float baseCost=(float)[Link]();
[Link]("The Advertisement cost is
%.1f",[Link](baseCost));
else if([Link]("text")){
int characters=[Link]();
TextAdvertisement ad1=new
TextAdvertisement(id,priority,noOfDays,clientName,characters);
float baseCost=(float)[Link]();
TextAdvertisement
return noOfCharacters;
[Link] = noOfCharacters;
}
public TextAdvertisement(int advertisementId, String priority, int noOfDays, String
clientName,
int noOfCharacters) {
[Link] = noOfCharacters;
@Override
float baseAdvertisementCost=baseCost*noOfCharacters*noOfDays;
float boosterCost=0f;
float serviceCost=0f;
if([Link]("high")){
boosterCost+=baseAdvertisementCost*0.1f;
serviceCost+=1000;
else if([Link]("medium")){
boosterCost+=baseAdvertisementCost*0.07f;
serviceCost+=700;
else if([Link]("low")){
serviceCost+=200;
return baseAdvertisementCost+boosterCost+serviceCost;
VideoAdvertisement
{
private int duration;
[Link] = duration;
return duration;
[Link] = duration;
@Override
float baseAdvertisementCost=baseCost*duration*noOfDays;
float boosterCost=0f;
float serviceCost=0f;
if([Link]("high")){
boosterCost+=baseAdvertisementCost*0.1f;
serviceCost+=1000;
else if([Link]("medium")){
boosterCost+=baseAdvertisementCost*0.07f;
serviceCost+=700;
else if([Link]("low")){
serviceCost+=200;
return baseAdvertisementCost+boosterCost+serviceCost;
Call Details
[Link]
[Link]=[Link]([Link](0,3));
[Link]=[Link]([Link](4,14));
[Link]=[Link]([Link](15));
return [Link];
return [Link];
[Link]
import [Link];
[Link](data);
[Link]("Call id:"+[Link]());
[Link]("Called number:"+[Link]());
[Link]("Duration:"+[Link]());
CreditCardValidator
[Link]
package [Link];
super();
[Link] = number;
return number;
[Link] = number;
CreditCardService
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
String msg=null;
if(validateAgainstBlocklist(card, fileName))
msg="Card is blocked";
else if(validateNumber([Link]()))
else
msg="valid card";
return msg;
if([Link]().equalsIgnoreCase(str2) ||
[Link]().equalsIgnoreCase(str3))
bol=true;
}
else{
bol=false;
return bol;
boolean bol=true;
if(len!=16)
bol=true;
else{
bol=false;
return bol;
// Get the blocklisted no's from the file and return list of numbers
for(int i=0;i<[Link];i++)
{
[Link](dig1[i]);
return li;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author
* This class is used to verify if the Code Skeleton is intact and not modified by participants thereby
ensuring smooth auto evaluation
*/
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"validate:String,validateAgainstBlocklist:boolean,validateNumber:boolean,getBlockListNumb
ers:List","[Link]");
}
private static final Logger LOG = [Link]("SkeletonValidator");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
} catch (Exception e) {
[Link]([Link],
return iscorrect;
try {
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if
(!([Link]().getSimpleName().equals(returnType))) {
errorFlag = true;
} else {
if (!foundMethod) {
errorFlag = true;
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
CreditCardValidatorMain
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
[Link](cardNumber);
//Write your code here read card numnber and create CreditCard object based on
cardnumber
String validationMessage=[Link](creditCard,
"resources/[Link]");
[Link](validationMessage);
Eshooping
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
[Link]([Link](amt));
[Link]
package [Link];
import [Link];
/**
*/
* Method to calculate total purchase amount for all the order line items
* @param orderLineItems
* @return totalOrderAmount
*/
double totalOrderAmount = 0;
int qt =0;
for(int i=0;i<[Link];i++){
qt = orderLineItems[i].quantity;
cost = orderLineItems[i].itemCostPerQuantity;
totalOrderAmount += (qt*cost);
/**
* @param totalOrderAmount
* @return discount
*/
if(totalOrderAmount<1000){
discount = (totalOrderAmount*10)/100;
}
discount = (totalOrderAmount*20)/100;
else if(totalOrderAmount>=10000){
discount = (totalOrderAmount*30)/100;
/**
* Method to verify if the order line item is flagged as Bulk Order or not
* @param lineItem
* @return boolean
*/
boolean result=false;
if([Link]>5){
result = true;
result=false;
/**
*
* @param orderLineItems
* @return
*/
int count = 0;
for(int i=0;i<[Link];i++){
if(isBulkOrder(orderLineItems[i])){
count++;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author 222805
* This class is used to verify if the Code Skeleton is intact and not modified by participants thereby
ensuring smooth auto evaluation
*/
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"calculateOrderTotalAmount:double,calculateDiscount:double,isBulkOrder:boolean,countOf
BulkOrderLineItems:int",
"[Link]");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
} catch (Exception e) {
[Link]([Link],
}
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if
(!([Link]().getName().equals(returnType))) {
errorFlag = true;
if (!foundMethod) {
errorFlag = true;
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
[Link]
package [Link];
/**
*/
return itemId;
[Link] = itemId;
return itemName;
[Link] = itemName;
return itemCostPerQuantity;
[Link] = itemCostPerQuantity;
}
return quantity;
[Link] = quantity;
[Link] = itemId;
[Link] = itemName;
[Link]=itemCostPerQuantity;
[Link] = quantity;
GPA Calculation
[Link]
package [Link];
import [Link].*;
import [Link].*;
[Link](new ArrayList<Integer>());
int option=0;
double gpa1=0;
do
{
[Link]("1. Add Grade\n2. Calculate GPA\n3. Exit");
option = [Link]([Link]());
switch(option)
[Link](grade);
break;
if(gpa1 > 0)
[Link]("GPA Scored");
[Link](gpa1);
else
break;
case 3 : break;
}while(option!=3);
[Link]
package [Link];
import [Link].*;
return gradePointList;
[Link] = gradePointList;
/*This method should add equivalent grade points based on the grade obtained by the student
passed as argument into gradePointList
Grade S A B C D E
Grade Point 10 9 8 7 6 5
For example if the gradeobtained is A, its equivalent grade points is 9 has to added into the
gradePointList*/
if(gradeObtained == 'S')
[Link](10);
{
[Link](9);
[Link](8);
[Link](7);
[Link](6);
else
[Link](5);
/* This method should return the GPA of all grades scored in the semester
For Example:
*/
double total=0,value=0,size=0;
size = [Link]();
if(size < 1)
return 0;
Iterator i = [Link]();
while([Link]())
value = (Integer)[Link]();
total += value;
gpa = total/size;
return gpa;
InsurancePremiumGenerator_v2
[Link]
package [Link];
public PropertyDetails() {
return builtUpArea;
[Link] = builtUpArea;
return builtYear;
[Link] = builtYear;
return reconstructionCost;
[Link] = reconstructionCost;
}
public Integer getHouseholdValuation() {
return householdValuation;
[Link] = householdValuation;
return burglaryCoverReqd;
[Link] = burglaryCoverReqd;
return politicalUnrestCoverReqd;
[Link] = politicalUnrestCoverReqd;
return sumAssured;
[Link] = sumAssured;
}
public PropertyDetails(Integer builtUpArea,Integer builtYear, Integer reconstructionCost,
Integer householdValuation,
super();
[Link] = builtUpArea;
[Link]=builtYear;
[Link] = reconstructionCost;
[Link] = householdValuation;
[Link] = burglaryCoverReqd;
[Link] = politicalUnrestCoverReqd;
[Link]
package [Link];
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
public class CalculatePremiumService {
double amountToBePaid = 0;
double additionalAmount1=0;
double additionalAmount2=0;
* calculatePremiumForPoliticalUnrestCoverage(propertyDetails, amountToBePaid)
* else return 0;
*/
if(!validatePropertyParameters(propertyDetails)) {
return 0;
amountToBePaid=calculatePremiumByPropertyAge(propertyDetails);
additionalAmount1=calculatePremiumForBurglaryCoverage(propertyDetails,
amountToBePaid);
additionalAmount2=calculatePremiumForPoliticalUnrestCoverage(propertyDetails,
amountToBePaid);
return [Link](amountToBePaid+additionalAmount1+additionalAmount2);
}
public boolean validatePropertyParameters(PropertyDetails propertyDetails) {
/*
* conditions to be checked
*/
if(!((householdValuation==Constants.MIN_HOUSEHOLD_VALUATION) ||
(householdValuation >= 100000 && householdValuation <= 1500000))) {
return false;
return false;
return true;
//Use Constants.MIN_PREMIUM_AMOUNT
int sumAssured =
[Link]()*[Link]()+[Link]
eholdValuation();
[Link](sumAssured);
double premium = 0;
if(propertyAge>15) {
premium =
Constants.MIN_PREMIUM_AMOUNT+([Link]()*0.35);
else if(propertyAge>=6) {
premium =
Constants.MIN_PREMIUM_AMOUNT+([Link]()*0.2);
else {
premium =
Constants.MIN_PREMIUM_AMOUNT+([Link]()*0.1);
return premium;
if([Link]().equalsIgnoreCase([Link])) {
return amount*.01;
return 0;
//Ex:-
[Link]().equalsIgnoreCase([Link]) to check condition
if([Link]().equalsIgnoreCase([Link])) {
return amount*.01;
}
return 0;
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author
* This class is used to verify if the Code Skeleton is intact and not modified by participants thereby
ensuring smooth auto evaluation
*/
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"checkOwnerDetails:boolean,getPremiumAmount:double,validatePropertyParameters:bool
ean,calculatePremiumByPropertyAge:double,calculatePremiumForBurglaryCoverage:double,calculat
ePremiumForPoliticalUnrestCoverage:double","[Link]
");
}
private static final Logger LOG = [Link]("SkeletonValidator");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
} catch (Exception e) {
[Link]([Link],
return iscorrect;
try {
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if
(!([Link]().getSimpleName().equals(returnType))) {
errorFlag = true;
} else {
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the given public
method " + methodName
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class InsurancePremiumGeneratorApp {
Integer builtUpArea = 0;
Integer builtYear=0;
Integer reconstructionCost = 0;
//read name
name = [Link]();
//read mobile
mobile = [Link]();
if([Link](name, mobile)) {
//read builtUpArea
builtUpArea = [Link]([Link]());
//read builtYear
builtYear = [Link]([Link]());
//read reconstructionCost
reconstructionCost = [Link]([Link]());
[Link](
//read response
if([Link]("yes")) {
//read householdValuation
householdValuation = [Link]([Link]());
//read burglaryCoverReqd
burglaryCoverReqd = [Link]();
[Link]("Do you want to include Political unrest cover? Please provide
yes/no");
//read politicalUnrestCoverReqd
politicalUnrestCoverReqd = [Link]();
if(premiumAmount==0.0) {
}else {
[Link]("Sum Insured:
Rs."+[Link]()+"\nInsurance Premium for the property of " + name + ": Rs."
+ premiumAmount);
Oil Stores
[Link]
import [Link];
int pc=[Link]();
[Link]("Enter category");
char cat=[Link]().charAt(0);
[Link]("Enter cost");
float c=[Link]();
[Link](n);
[Link](pc);
[Link](cat);
[Link](c);
float qty=[Link]();
[Link]
import [Link];
[Link]=name;
[Link]=pack;
[Link]=category;
[Link]=cost;
[Link]=name;
return name;
[Link]=pack;
return pack;
[Link]=category;
return category;
[Link]=cost;
return cost;
float price=((qty*1000)/pack)*cost;
return price;
}
Power Progress
import [Link].*;
int m=[Link]();
if(m<=0){
[Link](""+m+" is an invalid");
return;
int n=[Link]();
if(n<=0){
[Link](""+n+" is an invalid");
return;
if(m>=n){
return;
for(int i=1;i<=n;i++){
[Link]((int)[Link](m,i)+" ");
Singapore Tourism
import [Link].*;
public class Main
[Link]("BEACH",270);
[Link]("PILGRIMAGE",350);
[Link]("HERITAGE",430);
[Link]("HILLS",780);
[Link]("FALLS",1200);
[Link]("ADVENTURES",4500);
String pname=[Link]();
String name=[Link]();
if())
else
int nod=[Link]();
if(nod<=0)
else
if(not<=0)
else
double d=(double)[Link]([Link]());
double totalcost=d*(double)not*(double)nod;
if(totalcost>=1000)
totalcost=totalcost-((totalcost*15)/100);
}
Code RED
CasualEmployee:
return supplementaryHours; }
[Link] = supplementaryHours; }
return foodAllowance; }
[Link] = foodAllowance;
super(EmployeeId, EmployeeName,yearsOfExperience,gender,salary);
[Link]=supplementaryHours;
[Link]=foodAllowance;
double incsalary=total+(total*incrementPercentage/100);
return incsalary;
} }
Employee:
return EmployeeId; }
[Link] = employeeId; }
return EmployeeName;
[Link] = employeeName;
return yearsOfExperience;
[Link] = yearsOfExperience;
return gender;
[Link] = gender;
return salary;
}
public void setSalary(double salary) {
[Link] = salary;
super();
[Link] = employeeId;
[Link] = employeeName;
[Link] = yearsOfExperience;
[Link] = gender;
[Link]=salary;
PermanentEmployee:
return medicalAllowance;
[Link] = medicalAllowance;
return VehicleAllowance;
VehicleAllowance = vehicleAllowance;
[Link]=medicalAllowance;
[Link]=vehicleAllowance;
double incsalary=total+(total*incrementPercentage/100);
return incsalary;
TraineeEmployee:
return supplementaryTrainingHours;
[Link] = supplementaryTrainingHours;
return scorePoints;
[Link] = scorePoints;
{
super(EmployeeId, EmployeeName, yearsOfExperience, gender, salary);
[Link]=supplementaryTrainingHours;
[Link]=scorePoints;
double total=(supplementaryTrainingHours*500)+(scorePoints*50)+[Link];
double incsalary=total+(total*incrementPercentage/100);
return incsalary;
} }
UserInterface:
import [Link];
[Link]("Enter Gender");
[Link]("Enter Salary");
double salary=[Link]();
double incSalary=0;
incSalary=[Link](5);
incSalary = [Link](12);
incSalary=[Link](12);
else
} }
BookAMovieTicket:
[Link]=ticketId;
[Link]=customerName;
[Link]=mobileNumber;
[Link]=emailId;
[Link]=movieName;
return ticketId;
return emailId;
return movieName;
return mobileNumber;
[Link]=ticketId;
[Link]=customerName;
[Link]=mobileNumber;
[Link]=emailId;
[Link]=movieName;
GoldTicket:
int count=0;
if([Link]("GOLD"));
count++;
char[] cha=[Link]();
for(int i=4;i<7;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
if(count==4)
return true;
else
return false;
double amount;
if([Link]("yes")){
amount=500*numberOfTickets;
else{
amount=350*numberOfTickets;
return amount;
}
PlatinumTicket:
int count=0;
if([Link]("PLATINUM"));
count++;
char[] cha=[Link]();
for(int i=8;i<11;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
if(count==4)
return true;
else
return false;
double amount;
if([Link]("yes")){
amount=750*numberOfTickets;
}
else{
amount=600*numberOfTickets;
return amount;
SilverTicket:
int count=0;
if([Link]("SILVER"));
count++;
char[] cha=[Link]();
for(int i=6;i<9;i++){
if(cha[i]>='1'&& cha[i]<='9')
count++;
if(count==4)
return true;
else
return false;
double amount;
if([Link]("yes")){
amount=250*numberOfTickets;
else{
amount=100*numberOfTickets;
return amount;
UserInterface:
import [Link].*;
String tid=[Link]();
String cnm=[Link]();
long mno=[Link]();
String email=[Link]();
[Link]("Enter Movie Name");
String mnm=[Link]();
int tno=[Link]();
if([Link]("PLATINUM")){
boolean b1=[Link]();
if(b1==true){
else if(b1==false){
[Link](0);
else if([Link]("GOLD")){
boolean b2=[Link]();
if(b2==true){
else if (b2==false){
[Link]("Provide valid Ticket Id");
[Link](0);
else if([Link]("SILVER")){
boolean b3=[Link]();
if(b3==true){
else if(b3==false){
[Link](0);
}
TICKET RESERVATION
INVALID CARRIER-
[Link]-
public Passenger() {
super();
// TODO Auto-generated constructor stub
}
PASSENGER CATERGORY-
import [Link];
@FunctionalInterface
public interface PassengerCategorization {
abstract public List<Passenger> retrievePassenger_BySource(List<Passenger>
passengerRecord,String source);
PASSENGER UTILITY-
import [Link];
import [Link].*;
import [Link].*;
return list;
}
SKELETON VALIDATION-
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
/**
* @author TJ
*
* This class is used to verify if the Code Skeleton is intact and not modified by
participants thereby ensuring smooth auto evaluation
*
*/
public class SkeletonValidator {
public SkeletonValidator() {
validateClassName("PassengerCategorization");
validateClassName("Passenger");
validateClassName("InvalidCarrierException");
validateClassName("PassengerUtility");
validateMethodSignature(
"retrievePassenger_BySource:[Link]",
"PassengerCategorization");
validateMethodSignature(
"fetchPassenger:[Link]",
"PassengerUtility");
validateMethodSignature(
"isValidCarrierName:boolean",
"PassengerUtility");
validateMethodSignature(
"searchPassengerRecord:PassengerCategorization",
"UserInterface");
}
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class
name/package. Use the correct package "
+ "and class name as provided in the skeleton");
} catch (Exception e) {
[Link]([Link],
"There is an error in validating the " + "Class Name.
Please manually verify that the "
+ "Class name is same as skeleton before
uploading");
}
return iscorrect;
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
Method[] methods = [Link]();
for (Method findMethod : methods) {
if ([Link]([Link]())) {
foundMethod = true;
if (!
([Link]().getName().equals(returnType))) {
errorFlag = true;
[Link]([Link], " You have changed
the " + "return type in '" + methodName
+ "' method. Please stick to
the " + "skeleton provided");
} else {
[Link]("Method signature of " +
methodName + " is valid");
}
}
}
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the given
public method " + methodName
+ ". Do not change the " + "given public
method name. " + "Verify it with the skeleton");
}
}
if (!errorFlag) {
[Link]("Method signature is valid");
}
} catch (Exception e) {
[Link]([Link],
" There is an error in validating the " + "method
structure. Please manually verify that the "
+ "Method signature is same as the
skeleton before uploading");
}
}
USER INTERFACE-
import [Link].*;
import [Link].*;
if(([Link]().toLowerCase()).equals([Link]())){
[Link](pass);
}
}
return result;
};
}
PassengerCategorization pc = searchPassengerRecord();
//FILL THE CODE HERE
[Link]("Invalid Carrier Records are:");
PassengerUtility pu = new PassengerUtility();
List<Passenger> list = null;
try{
list = [Link](new String("[Link]"));
}
catch(FileNotFoundException e){
[Link]();
}
catch(IOException e){
[Link]();
}
catch(Exception e){
[Link]();
}
[Link]("Enter the source to search");
Scanner sc = new Scanner([Link]);
String inp = [Link]();
INVALID LAPTOP-
package [Link];
public class InvalidLaptopIdException extends Exception{
public InvalidLaptopIdException() {
[Link]-
package [Link];
import [Link];
import [Link].*;
import [Link];
import [Link].*;
import [Link];
import [Link].*;
}
}
LAPTOP [Link]-
package [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link].*;
import [Link];
import [Link];
/**
* Method to access file
*
* @return File
*/
public File accessFile()
{
/**
* Method to validate LaptopId and, for invalid laptopId throw
InvalidLaptopIdException with laptopId as argument
*
* @param laptopid
* @return status
*/
if([Link]().startsWith("ZEE"))
{
}else{
throw new InvalidLaptopIdException(laptopId);
}
return true;
//TODO change this return value
}
/**
* Method to read file ,Do necessary operations , writes validated data to
List and prints invalid laptopID in its catch block
*
* @param file
* @return List
*/
while((c=[Link]())!=-1)
{
s1+=(char)c;
}
}catch(FileNotFoundException e)
{
[Link]();
}catch(IOException e)
{
[Link]();
}
String[] arr=[Link]("\n");
String[] laptopids=new String[4];
Laptop l;
for(String s:arr)
{
l=new Laptop();
laptopids=[Link](",");
[Link](laptopids[0]);
[Link](laptopids[1]);
[Link]([Link]((laptopids[2])));
[Link]([Link](laptopids[3]));
[Link](l);
[Link]([Link]()*[Link]());
[Link](l);
/**
* Method to find and set totalAmount based on basicCost and noOfdays
*
*
*
*/
{
//Type code here to calculate totalAmount based on no of days and basic
cost
double d=[Link]()*[Link]();
[Link](d);
}
SKELETON VALIDATOR-
package [Link];
import [Link];
import [Link];
import [Link];
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"accessFile:[Link],validate:boolean,readData:[Link]",
"[Link]");
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " +
"class name/package. Use the correct package "
+ "and class name as provided in the
skeleton");
} catch (Exception e) {
[Link]([Link],
"There is an error in validating the " + "Class
Name. Please manually verify that the "
+ "Class name is same as skeleton
before uploading");
}
return iscorrect;
}
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
Method[] methods = [Link]();
for (Method findMethod : methods) {
if ([Link]([Link]())) {
foundMethod = true;
if (!
([Link]().getName().equals(returnType))) {
errorFlag = true;
[Link]([Link], " You have
changed the " + "return type in '" + methodName
+ "' method. Please
stick to the " + "skeleton provided");
} else {
[Link]("Method signature of " +
methodName + " is valid");
}
}
}
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the
given public method " + methodName
+ ". Do not change the " + "given
public method name. " + "Verify it with the skeleton");
}
}
if (!errorFlag) {
[Link]("Method signature is valid");
}
} catch (Exception e) {
[Link]([Link],
" There is an error in validating the " +
"method structure. Please manually verify that the "
+ "Method signature is same as the
skeleton before uploading");
}
}
}
[Link]-
package [Link];
/**
* Value Object - Laptop
*
*/
public Laptop()
{
}
public String toString()
{
return "Laptop [laptopId="+[Link]()+",
customerName="+[Link]()+", basicCost="+[Link]()+",
noOfDays="+[Link]()+", totalAmount="+[Link]()+"]";
}
public String getLaptopId() {
return laptopId;
}
public void setLaptopId(String laptopId) {
[Link] = laptopId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
[Link] = customerName;
}
public double getBasicCost() {
return basicCost;
}
public void setBasicCost(double basicCost) {
[Link] = basicCost;
}
public int getNoOfDays() {
return noOfDays;
}
public void setNoOfDays(int noOfDays) {
[Link] = noOfDays;
}
public double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(double totalAmount) {
[Link] = totalAmount;
}
LAPTOP DETAILS-
Laptop Details:
ZEE01,Jack,2000.50,4
ZEE02,Dev,4000.00,3
EEZ03,John,4500.00,5
ZAE04,Milan,3500.00,4
ZEE05,Surya,2500.50,7
ZEE06,Milan,5000.00,6
USER INTERFACE-
package [Link];
import [Link];
import [Link];
switch(choice){
case 1:
[Link]("Enter the day");
String day = [Link]();
[Link]("Enter the customer count");
int cc = [Link]();
[Link](cc);
break;
case 2:
double res = [Link]();
if(res==0){
[Link]("No records found");
//break;
}
else{
[Link](res);
//break;
}
break;
case 3:
[Link]("Thank you for using the application");
flag = false;
break;
}
}
}
}
[Link]-
package [Link];
import [Link];
import [Link].*;
import [Link];
// This Method should add the customerCount passed as argument into the
// bookingList
/*
* This method should return the average customer booked based on the
* customerCount values available in the bookingList.
*/
if(counter==0) return 0;
avg = count/counter;
return avg;
}
}
PASSENGER
PASSENGER UTILITY-
import [Link];
import [Link].*;
import [Link].*;
return list;
}
PASSENGER CATEGORIZATION-
PASSENGER SKELETION-
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
/**
* @author TJ
*
* This class is used to verify if the Code Skeleton is intact and not modified by
participants thereby ensuring smooth auto evaluation
*
*/
public class SkeletonValidator {
public SkeletonValidator() {
validateClassName("PassengerCategorization");
validateClassName("Passenger");
validateClassName("InvalidCarrierException");
validateClassName("PassengerUtility");
validateMethodSignature(
"retrievePassenger_BySource:[Link]",
"PassengerCategorization");
validateMethodSignature(
"fetchPassenger:[Link]",
"PassengerUtility");
validateMethodSignature(
"isValidCarrierName:boolean",
"PassengerUtility");
validateMethodSignature(
"searchPassengerRecord:PassengerCategorization",
"UserInterface");
}
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class
name/package. Use the correct package "
+ "and class name as provided in the skeleton");
} catch (Exception e) {
[Link]([Link],
"There is an error in validating the " + "Class Name.
Please manually verify that the "
+ "Class name is same as skeleton before
uploading");
}
return iscorrect;
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
Method[] methods = [Link]();
for (Method findMethod : methods) {
if ([Link]([Link]())) {
foundMethod = true;
if (!
([Link]().getName().equals(returnType))) {
errorFlag = true;
[Link]([Link], " You have changed
the " + "return type in '" + methodName
+ "' method. Please stick to
the " + "skeleton provided");
} else {
[Link]("Method signature of " +
methodName + " is valid");
}
}
}
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the given
public method " + methodName
+ ". Do not change the " + "given public
method name. " + "Verify it with the skeleton");
}
}
if (!errorFlag) {
[Link]("Method signature is valid");
}
} catch (Exception e) {
[Link]([Link],
" There is an error in validating the " + "method
structure. Please manually verify that the "
+ "Method signature is same as the
skeleton before uploading");
}
}
import [Link].*;
import [Link].*;
if(([Link]().toLowerCase()).equals([Link]())){
[Link](pass);
}
}
return result;
};
}
PassengerCategorization pc = searchPassengerRecord();
//FILL THE CODE HERE
[Link]("Invalid Carrier Records are:");
PassengerUtility pu = new PassengerUtility();
List<Passenger> list = null;
try{
list = [Link](new String("[Link]"));
}
catch(FileNotFoundException e){
[Link]();
}
catch(IOException e){
[Link]();
}
catch(Exception e){
[Link]();
}
[Link]("Enter the source to search");
Scanner sc = new Scanner([Link]);
String inp = [Link]();
EMPLOYEE SALARY
EMPLOYEE-
MAIN .JAVA-
1 import [Link].*;
2 public class Main {
3
4 public static void main(String[] args)
5 {
6 Scanner read=new Scanner([Link]);
7
8 //Fill the code
9 try
10 {
11 [Link]("Enter the Employee Id");
12 int id=[Link]([Link]());
13 [Link]("Enter the Employee Name");
14 String name=[Link]();
15 [Link]("Enter the salary");
16 double salary=[Link]([Link]());
17 [Link]("Enter the Number of Years in Experience");
18 int exp_year=[Link]([Link]());
19 Employee e=new Employee(id,name,salary);
20 [Link](exp_year);
21
22 double incrementedSalary=[Link]();
23 [Link]("Incremented Salary %.2f", incrementedSalary);
24 }
25 catch(Exception e)
26 {
27 [Link](e);
28 }
29 }
30
31 }
HOME APPLIANCES
USER INTERFACE-
import [Link].*;
public class HomeAppliances {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter Product Id");
String id = [Link]();
[Link]("Enter Product Name");
String name = [Link]();
switch (name)
{
case "AirConditioner":
{
[Link]("Enter Batch Id");
String batch = [Link]();
[Link]("Enter Dispatch
date");
String date = [Link]();
[Link]("Enter Warranty
Years");
int years = [Link]();
[Link]("Enter type of Air
Conditioner");
String type = [Link]();
[Link]("Enter quantity");
double capac = [Link]();
AirConditioner ob1 = new
AirConditioner(id, name, batch, date, years, type,
capac);
double price =
[Link]();
[Link]("Price of the Product
is %.2f ", price);
}
case "LEDTV":
{
[Link]("Enter Batch Id");
String batch = [Link]();
[Link]("Enter Dispatch
date");
String date = [Link]();
[Link]("Enter Warranty
Years");
int years = [Link]();
[Link](name);
[Link]("Enter size in
inches");
int size = [Link]();
[Link]("Enter quality");
String quality = [Link]();
LEDTV ob2 = new LEDTV(id, name, batch,
date, years, size, quality);
double price =
[Link]();
[Link]("Price of the Product
is %.2f ", price);
}
case "MicrowaveOven":
{
[Link]("Enter Batch Id");
String batch = [Link]();
[Link]("Enter Dispatch
date");
String date = [Link]();
[Link]("Enter Warranty
Years");
int years = [Link]();
[Link]("Enter quantity");
int quantity = [Link]();
[Link]("Enter quality");
String quality = [Link]();
MicrowaveOven ob3 = new
MicrowaveOven(id, name, batch, date, years,
quantity, quality);
double price =
[Link]();
[Link]("Price of the Product
is %.2f ", price);
}
default: {
[Link]("Provide a valid
Product name");
}
}
}
}
[Link]
ELECTRONIC [Link]-
LED [Link]
CINEMA
PLATINUM TICKET-
GOLD TICKET-
SILVER TICKET-
USER INTERFACE-
import [Link].*;
public class UserInterface {
public static void main(String[] args) {
Scanner sc=new Scanner([Link]);
[Link]("Enter Ticket Id");
String tid=[Link]();
[Link]("Enter Customer Name");
String cnm=[Link]();
[Link]("Enter Mobile Number");
long mno=[Link]();
[Link]("Enter Email id");
String email=[Link]();
[Link]("Enter Movie Name");
String mnm=[Link]();
[Link]("Enter number of tickets");
int tno=[Link]();
[Link]("Do you want AC or not");
String choice =[Link]();
if([Link]("PLATINUM")){
PlatinumTicket PT=new PlatinumTicket(tid,cnm,mno,email,mnm);
boolean b1=[Link]();
if(b1==true){
double cost =[Link](tno, choice);
[Link]("Ticket cost is "+ cost);
}
else if(b1==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
else if([Link]("GOLD")){
GoldTicket GT=new GoldTicket(tid,cnm,mno,email,mnm);
boolean b2=[Link]();
if(b2==true){
double cost=[Link](tno, choice);
[Link]("Ticket cost is "+cost);
}
else if (b2==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
else if([Link]("SILVER")){
SilverTicket ST=new SilverTicket(tid,cnm,mno,email,mnm);
boolean b3=[Link]();
if(b3==true){
double cost=[Link](tno, choice);
[Link]("Ticket cost is "+cost);
}
else if(b3==false){
[Link]("Provide valid Ticket Id");
[Link](0);
}
}
}
}
Reverse A word
helloworld:
String[] words;
if ([Link]<3) {
if ([Link](b)&& [Link](c)) {
[Link](words[[Link]-1]);
input1 =[Link]();
[Link](words[0]);
[Link](input1);
} else {
[Link](words[0]);
[Link]();
[Link](words[[Link]-1]);
[Link](input1); }
}
KidsorHome
AirConditioner:
[Link] = airConditionerType;
[Link] = capacity;
return airConditionerType;
[Link] = airConditionerType;
return capacity;
[Link] = capacity;
double price = 0;
if([Link]("Residential")){
if (capacity == 2.5){
price = 32000;
price = 40000;
price = 47000;
} }
else if([Link]("Commercial"))
{ if (capacity == 2.5){
price = 40000;
price = 55000;
price = 67000;
} }
else if([Link]("Industrial")){
if (capacity == 2.5){
price = 47000;
price = 60000;
price = 70000;
} }
return price;
} }
ElectronicProducts:
[Link] = productId;
[Link] = productName;
[Link] = batchId;
[Link] = dispatchDate;
[Link] = warrantyYears;
return productId;
[Link] = productId;
return productName;
[Link] = productName;
return batchId;
[Link] = batchId;
return dispatchDate;
[Link] = dispatchDate;
return warrantyYears;
[Link] = warrantyYears;
} }
LEDTV:
[Link] = quality;
return size;
[Link] = size;
return quality;
[Link] = quality;
double price = 0;
if([Link]("Low")){
} else if([Link]("Medium")){
} else if([Link]("High")){
return price;
} }
MicrowaveOven:
[Link] = quantity;
[Link] = quality;
} public int getQuantity() {
return quantity;
[Link] = quantity;
return quality;
[Link] = quality;
double price = 0;
if([Link]("Low")){
} else if([Link]("Medium")){
} else if([Link]("High")){
return price;
} }
UserInterface:
import [Link];
double price;
String quality;
switch(productName){
case "AirConditioner":
[Link]("Enter quantity");
price = [Link]();
break;
case "LEDTV":
[Link]("Enter quality");
quality = [Link]();
price = [Link]();
break;
case "MicrowaveOven":
[Link]("Enter quantity");
quality = [Link]();
price = [Link]();
break;
default:
[Link](0);
}
Slogan
Main:
import [Link];
String slogan=[Link]();
char[] ch=[Link]();
for(int i=0;i<[Link]();i++){
} else{
[Link]("Invalid slogan");
return;
int sum=0;
int mul=0;
char c = [Link](i);
count[c]++;
if (count[chh] == 1) {
sum++;
} else {
mul++; }
} if(sum==mul){
} else{
}
1. AirVoice - Registration
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
SmartBuy is a leading mobile shop in the town. After buying a product, the customer needs to
provide a few personal details for the invoice to be generated.
You being their software consultant have been approached to develop software to retrieve the
personal details of the customers, which will help them to generate the invoice faster.
String emailId
int age
Get the details as shown in the sample input and assign the value for its attributes using the
setters.
Display the details as shown in the sample output using the getters method.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes and methods as specified in the question.
Sample Input 1:
john
Enter the ContactNumber:
9874561230
john@[Link]
32
Sample Output 1:
Name:john
ContactNumber:9874561230
EmailId:john@[Link]
Age:32
Automatic evaluation[+]
[Link]
1 public class Customer {
2 private String customerName;
3
4 private long contactNumber;
5
6 private String emailId;
7
8 private int age;
9
10 public String getCustomerName() {
11 return customerName;
12 }
13
14 public void setCustomerName(String customerName) {
15 [Link] = customerName;
16 }
17
18 public long getContactNumber() {
19 return contactNumber;
20 }
21
22 public void setContactNumber(long contactNumber) {
23 [Link] = contactNumber;
24 }
25
26 public String getEmailId() {
27 return emailId;
28 }
29
30 public void setEmailId(String emailId) {
31 [Link]= emailId;
32 }
33
34 public int getAge() {
35 return age;
36 }
37
38 public void setAge(int age){
39 [Link] = age;
40 }
41
42
43
44 }
[Link]
1 import [Link];
2
3 public class Main {
4
5 public static void main (String[] args) {
6 Scanner sc=new Scanner([Link]);
7
8 //Fill the code
9 Customer c=new Customer();
10 [Link]("Enter the Name:");
11 String name=([Link]());
12 [Link]("Enter the ContactNumber:");
13 long no=[Link]();
14 [Link]();
15 [Link]("Enter the EmailId:");
16 String mail=[Link]();
17
18 [Link]("Enter the Age:");
19 int age=[Link]();
20 [Link](name);
21 [Link](no);
22 [Link](mail);
23 [Link](age);
24 [Link]("Name:"+[Link]());
25 [Link]("ContactNumber:"+[Link]());
26 [Link]("EmailId:"+[Link]());
27 [Link]("Age:"+[Link]());
28
29
30
31 }
32
33 }
2. Grade
Reviewed on Friday, 10 December 2021, 6:14 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
3. ZeeZee bank
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
ZeeZee is a leading private sector bank. In the last Annual meeting, they decided to give their
customer a 24/7 banking facility. As an initiative, the bank outlined to develop a stand-alone
device that would offer deposit and withdrawal of money to the customers anytime.
You being their software consultant have been approached to develop software to implement the
functionality of deposit and withdrawal anytime.
As per this requirement, the customer should be able to deposit money into his account at any
time and the deposited amount should reflect in his account balance.
As per this requirement, the customer should be able to withdraw money from his account
anytime he wants. The amount to be withdrawn should be less than or equal to the balance in
the account. After the withdrawal, the account should reflect the balance amount
Component Specification: Account
In the Main class, Get the details as shown in the sample input.
Create an object for the Account class and invoke the deposit method to deposit the amount and
withdraw method to withdraw the amount from the account.
Note:
If the balance amount is insufficient then display the message as shown in the Sample Input /
Output.
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes, and methods as specified in the question.
Sample Input/Output 1:
1234567890
15000
Enter the amount to be deposited:
1500
500
Sample Input/Output 2:
1234567890
15000
1500
18500
Insufficient balance
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link];
3
4 public class Main{
5
6 public static void main (String[] args) {
7 Scanner sc=new Scanner([Link]);
8 DecimalFormat decimalFormat=new DecimalFormat("0.00");
9 [Link]("Enter the account number:");
10 long accountNumber= [Link]();
11 [Link]("Enter the available amount in the account:");
12 double balanceAmount= [Link]();
13 Account account=new Account(accountNumber,balanceAmount);
14 [Link]("Enter the amount to be deposited:");
15 double depositAmount=[Link]();
16 [Link](depositAmount);
17 double availableBalance=[Link]();
18 [Link]("Available balance is:"+[Link](availableBalance));
19 [Link]("Enter the amount to be withdrawn:");
20 double withdrawAmount= [Link]();
21 boolean isWithdrawn=[Link](withdrawAmount);
22 availableBalance=[Link]();
23 if(!isWithdrawn){
24 [Link]("Insufficient balance");
25 }
26 [Link]("Available balance is:"+[Link](availableBalance));
27
28 //Fill the code
29 }
30 }
[Link]
1
2 public class Account {
3 private long accountNumber;
4 private double balanceAmount;
5 public Account(long accountNumber,double balanceAmount){
6 [Link]=accountNumber;
7 [Link]=balanceAmount;
8 }
9 public long getAccountNumber(){
10 return accountNumber;
11 }
12 public void setAccountNumber(long accountNumber){
13 [Link]=accountNumber;
14 }
15 public double getBalanceAmount(){
16 return balanceAmount;
17 }
18 public void setBalanceAmount(double balanceAmount){
19 [Link]=balanceAmount;
20 }
21 public void deposit(double depositAmount){
22 balanceAmount+=depositAmount;
23 }
24 public boolean withdraw(double withdrawAmount){
25 if(withdrawAmount<=balanceAmount){
26 balanceAmount-=withdrawAmount;
27 return true;
28 }
29 return false;
30 }
31 }
Grade
Reviewed on Thursday, 27 May 2021, 3:28 AM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
[Link] Details
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 16 s
AirCarrier is a leading mobile network provider. They maintain a record of all the calls made by
their postpaid [Link] details are stored in a particular format
[callId:calledNumber:noOfMinutes] .At the end of every month, the network provider wants to
extract the information from the file and populate it to the Call object for calculating the bill.
You being their software consultant have been approached to develop software to implement the
functionality of extracting the data from the given format.
float duration
This requirement is responsible for extracting the customer’s callId, calledNumber and duration
from the callDetails. After the extraction set the callId, calledNumber and duration to the call
object.
In the Main class, Get the details as shown in the sample input.
Create an object for the Call and invoke the parseData method to set the callId, calledNumber
and duration for each customer.
Invoke the corresponding getters to display the call details as shown in the Sample Output
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Ensure to provide the names for classes, attributes and methods as specified in the question.
Sample Input 1:
102:6547891230:2.15
Sample Output 1:
Call id:102
Called number:6547891230
Duration:2.15
============================================================
Automatic evaluation[+]
[Link]
1 import [Link];
2
3 public class Main {
4
5 public static void main (String[] args) {
6 Scanner sc=new Scanner([Link]);
7 [Link]("Enter the call details:");
8 String a=[Link]();
9 Call obj=new Call();
10 [Link](a);
11 [Link]("Call id:"+[Link]());
12 [Link]("Called number:"+[Link]());
13 [Link]("Duration:"+[Link]());
14 //Fill the code
15
16 }
17 }
[Link]
1
2 public class Call {
3 private int callId;
4 private long calledNumber;
5 private float duration;
6 public Call(){
7 }
8 public int getCallId(){
9 return callId;
10 }
11 public long getCalledNumber(){
12 return calledNumber;
13 }
14 public float getDuration(){
15 return duration;
16 }
17 public void setCallId(int callId){
18 [Link]=callId;
19 }
20 public void setCalledNumber(long calledNumber){
21 [Link]=calledNumber;
22 }
23 public void setDuration(float duration){
24 [Link]=duration;
25 }
26 public void parseData(String calld){
27 callId=[Link]([Link](":")[0]);
28 setCallId(callId);
29 calledNumber=[Link]([Link](":")[1]);
30 setCalledNumber(calledNumber);
31 duration=[Link]([Link](":")[2]);
32 setDuration(duration);
33 }
34 }
Grade
Reviewed on Tuesday, 4 May 2021, 4:58 AM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
The pair is found by checking whether the product of the numbers is same as the product of the
reversed numbers. If it is same, then print "Correct pair found". If not print, "Correct pair not
found".
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
Hint: [13*62=31*26]
Sample Input 1:
13
62
Sample Output 1:
Sample Input 2:
10
56
Sample Output 2:
Automatic evaluation[+]
[Link]
1 import [Link].*;
2
3 public class Main{
4
5 public static void main (String[] args) {
6 Scanner sc=new Scanner([Link]);
7
8 int a=[Link]();
9 int b=[Link]();
10 if(a>99||a<10||b>99||b<10){
11 [Link]("No");
12
13 }
14 Main obj=new Main();
15 int ra=[Link](a);
16 int rb=[Link](b);
17 if(a*b==ra*rb){
18 [Link](a+" and "+b+" are correct pair");
19 }
20 else{
21 [Link](a+" and "+b+" are not correct pair");
22 }
23 }
24 int rvs(int num){
25 int r,rnum=0;
26 while(num>0)
27 {
28 r=num%10;
29 rnum=rnum*10+r;
30 num/=10;
31 }
32 return(rnum);
33 }
34 }
35
36
37
38
39
40
Grade
Reviewed on Thursday, 27 May 2021, 3:38 AM by Automatic grade
Grade 100 / 100
Assessment report
TEST CASE PASSED
[+]Grading and Feedback
----------------------------------End---------------------------------------------------
Group-2
You being their software consultant have been approached by them to develop an application
which can be used for managing their business. You need to implement a java program using
thread to find out the count of members in each membership category. Membership details
should be obtained from the user in the console.
Count the number of members available in the memberList based on the membership category
to be searched and set the value to count attribute.
Create a class called Main with the main method and get the inputs like number of
members, member details, number of times Membership category needs to be
searched and Membership category to be searched from the user.
Parse the member details and set the values for all attributes in Member class
using constructor.
Invoke the ZEEShop thread class for each memberCategory and count the number of members
in that category and display the count as shown in the sample input and output.
Assumption: The memberCategory is case –sensitive and will be of only three values –
Platinum or Gold or Silver.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
102:Sam:Gold
103:John:Silver
104:Rose:Platinum
105:Tint:Silver
Gold
Silver
Platinum
Gold
Gold:2
Silver:2
Platinum:1
Gold:2
Automatic evaluation[+]
[Link]
1
2 public class Member {
3
4 private String memberId;
5 private String memberName;
6 private String category;
7
8 public String getMemberId() {
9 return memberId;
10 }
11 public void setMemberId(String memberId) {
12 [Link] = memberId;
13 }
14 public String getMemberName() {
15 return memberName;
16 }
17 public void setMemberName(String memberName) {
18 [Link] = memberName;
19 }
20 public String getCategory() {
21 return category;
22 }
23 public void setCategory(String category) {
24 [Link] = category;
25 }
26
27 public Member(String memberId, String memberName, String category) {
28 super();
29 [Link] = memberId;
30 [Link] = memberName;
31 [Link] = category;
32 }
33
34
35 }
[Link]
1 import [Link].*;
2 public class Main {
3
4 public static void main(String args[]){
5 // Fill the code here
6 List<Member> memberList = new ArrayList<Member>();
7 Scanner scan = new Scanner([Link]);
8 [Link]("Enter the no of Members");
9 int memberCount = [Link]();
10 String tempIp;
11 while(memberCount>0){
12 [Link]("Enter the member details");
13 tempIp = [Link]();
14 String tempArr[] = [Link](":");
15 [Link](new Member(tempArr[0],tempArr[1],tempArr[2]));
16 memberCount--;
17 }
18 [Link]("Enter the number of times Membership category needs to be searched");
19 int noOfTimes = [Link]();
20 String[] tempArr = new String[noOfTimes];
21 for(int index=0;index<noOfTimes;index++){
22 [Link]("Enter the category");
23 tempArr[index] = [Link]();
24 }
25 int countArr[] = new int [noOfTimes];
26 for(int i=0; i<noOfTimes;i++){
27 ZEEShop thread = new ZEEShop(tempArr[i],memberList);
28 [Link]();
29 /*try{
30 [Link]();
31 }catch(InterruptedException e){
32
33 }*/
34 countArr[i] = [Link]();
35 }
36 for(int i=0;i<noOfTimes;i++){
37 [Link](tempArr[i]+ ":"+countArr[i]);
38 }
39 [Link]();
40 /*List<ZEEShop> zList = new ArrayList<ZEEShop>()
41 for(int i = 0;i<count;i++){
42 ZEEShop zs = new ZEEShop(category , memList);
43 [Link](zs);
44 }
45 for(ZEEShop z: zeelist){
46 [Link]();
47 try{
48 [Link]();
49 }catch(Exception e){
50 [Link]();
51 }
52 }*/
53 }
54 }
55
[Link]
1 import [Link].*;
2 public class ZEEShop extends Thread {
3 // Fill the code here
4 private String memberCategory;
5 private int count;
6 private List<Member> memberList;
7 public ZEEShop(String memberCategory, List memberList){
8 super();
9 [Link] = memberCategory;
10 [Link] = memberList;
11 }
12 public int getCount(){
13 return count;
14 }
15 public String getMemberCategory(){
16 return memberCategory;
17 }
18 public List<Member> getMemberList(){
19 return memberList;
20 }
21 public void setMemberCategory(String memberCategory){
22 [Link] = memberCategory;
23 }
24 public void setMemberList(List<Member> memberList){
25 [Link] = memberList;
26 }
27 public void setCount(int count){
28 [Link] = count;
29 }
30 public void run(){
31
32 synchronized(this)
33 {
34 for(Member m : memberList){
35 if([Link]().equals(memberCategory))
36 count++;
37 }
38
39 }
40 }
41 }
42
Grade
Reviewed on Friday, 7 January 2022, 7:25 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
2. Grade Calculation
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum execution time: 32 s
Grade Calculation
Rita is working as a science teacher in an International school. She is the Class Teacher of class
V and was busy in calculating the grade for each student in her class, based on his/her total
marks obtained in SA1 assessment.
Since she found it very difficult to calculate the grade, she approached you to develop an
application which can be used for completing her task faster. You need to implement a java
program using thread to calculate the grade for each student. Student details should be obtained
from the user in the console.
Calculate the grade based on total marks (sum of all marks) as shown below obtained by each
student and set the same in result attribute for respective student.
Assumption: Each student will have only five subjects and marks of each subject will be greater
than or equal to 0 and lesser than or equal to 100. Hence the maximum Total marks obtained by
each student will be 500. And the minimum Total marks obtained by each student will be 0.
Create a class called Main with the main method and get the inputs like number of
threads and Student details from the user.
Parse the student details and set the values of studName and marks attributes
in GradeCalculator thread class using constructor.
Invoke the GradeCalculator thread class to calculate the grade based on total marks and set the
same to result attribute.
Display the Student name and Grade obtained by each student as shown in the sample input
and output.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
Jeba:100:80:90:40:55
Adam:90:80:90:50:75
Rohit:99:99:99:99:99
Jeba:B
David:E
Adam:B
Rohit:A
Automatic evaluation[+]
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 public class Main {
5 public static void main(String[] args) throws Exception {
6 BufferedReader br=new BufferedReader(new InputStreamReader([Link]));
7 [Link]("Enter the number of Threads");
8 int th=[Link]([Link]());
9 GradeCalculator obj=null;
10 String str="";
11 String[] details=new String[th];
12 for(int i=0;i<th;i++)
13 {
14 [Link]("Enter the String");
15 str=[Link]();
16 details[i]=str;
17 }
18 for(int i=0;i<th;i++)
19 {
20 String sp[]=details[i].split(":");
21 int k=0;
22 int arr[]=new int[[Link]];
23 for(int j=1;j<[Link];j++)
24 arr[k++]=[Link](sp[j]);
25 obj=new GradeCalculator(sp[0],arr);
26 [Link]();
27 try{
28 [Link](1000);
29 }
30 catch(Exception e)
31 {
32 [Link](e);
33 }
34 }
35 //Fill your code here
36
37 }
38
39 }
[Link]
1
2 public class GradeCalculator extends Thread{
3 private String studName;
4 private char result;
5 private int[] marks;
6 public String getStudName()
7 {
8 return studName;
9 }
10 public void setStudName()
11 {
12 [Link]=studName;
13 }
14 public char getResult()
15 {
16 return result;
17 }
18 public void setResult(char result)
19 {
20 [Link]=result;
21 }
22 public int[] getMarks()
23 {
24 return marks;
25 }
26 public void setMarks(int[] marks)
27 {
28 [Link]=marks;
29 }
30 public GradeCalculator(String studName,int[] marks)
31 {
32 [Link]=studName;
33 [Link]=marks;
34 }
35 public void run()
36 {
37 int sum=0;
38 int[] score=getMarks();
39 for(int i=0;i<[Link];i++)
40 sum=sum+score[i];
41 if((400<=sum)&&(sum<=500))
42 [Link](getStudName()+":"+'A');
43 if((300<=sum)&&(sum<=399))
44 [Link](getStudName()+":"+'B');
45 if((200<=sum)&&(sum<=299))
46 [Link](getStudName()+":"+'C');
47 if(sum<200)
48 [Link](getStudName()+":"+'E');
49 }
50 }
Grade
Reviewed on Friday, 7 January 2022, 7:24 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
You being his best friend, help him in completing his weekend assignment. You need to
implement a java program using inner class concept to display the details available in
primaryDataSet, secondaryDataSet and Query.
Create a class called TestApplication with the main method and get the inputs for primary data
set and secondary data set like theatreId, theatreName, location, noOfScreen and ticketCost,
and details of Query like queryId and queryCategory from the user.
Display the details of primary data set, secondary data set and Query as shown in the sample
input and output.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
PNR6001
KV cinemas
Chennai
120
RNV5001
Inoxe
Bangalore
5
Enter the ticket cost
150
Q510
DML
Theatre id : PNR6001
Location : Chennai
No of Screen : 8
Theatre id : RNV5001
Location : Bangalore
No of Screen : 5
Query id : Q510
Automatic evaluation[+]
[Link]
1
2 //Write the required business logic as expected in the question description
3
4 public class Query {
5 private String queryId;
6 private String queryCategory;
7 private DataSet primaryDataSet;
8 private DataSet secondaryDataSet;
9
10 @Override
11 public String toString()
12 {
13 String g="";
14 g+=("Primary data set"+"\n");
15 g+=("Theatre id :"+[Link]()+"\n");
16 g+=("Theatre name :"+[Link]()+"\n");
17 g+=("Location :"+[Link]()+"\n");
18 g+=("No of Screen :"+[Link]()+"\n");
19 g+=("Ticket Cost :"+[Link]()+"\n");
20
21 g+=("Secondary data set"+"\n");
22 g+=("Theatre id :"+[Link]()+"\n");
23 g+=("Theatre name :"+[Link]()+"\n");
24 g+=("Location :"+[Link]()+"\n");
25 g+=("No of Screen :"+[Link]()+"\n");
26 g+=("Ticket Cost :"+[Link]()+"\n");
27 g+=("Query id : "+queryId+"\n");
28 g+=("Query category : "+queryCategory+"\n");
29
30 return g;
31 }
32 public class DataSet{
33 private String theatreId;
34 private String theatreName;
35 private String location;
36 private int noOfScreen;
37 private double ticketCost;
38
39 public double getTicketCost()
40 {
41 return ticketCost;
42 }
43 public void setTicketCost(double a)
44 {
45 ticketCost=a;
46 }
47
48 public int getNoOfScreen()
49 {
50 return noOfScreen;
51 }
52 public void setNoOfScreen(int a)
53 {
54 noOfScreen=a;
55 }
56 public String getLocation()
57 {
58 return location;
59 }
60 public void setLocation(String a)
61 {
62 location=a;
63 }
64 public String getTheatreName ()
65 {
66 return theatreName;
67 }
68 public void setTheatreName(String a)
69 {
70 theatreName=a;
71 }
72
73 public String getTheatreId()
74 {
75 return theatreId;
76 }
77 public void setTheatreId(String a)
78 {
79 theatreId=a;
80 }
81 }
82 public void setSecondaryDataSet(DataSet pD)
83 {
84 [Link]=pD;
85 }
86 public DataSet getSecondaryDataSet()
87 {
88 return [Link];
89 }
90 public void setPrimaryDataSet(DataSet pD)
91 {
92 [Link]=pD;
93 }
94 public DataSet getPrimaryDataSet()
95 {
96 return [Link];
97 }
98 public void setQueryId (String queryId)
99 {
100 [Link]=queryId;
101 }
102 public void setQueryCategory(String queryCategory)
103 {
104 [Link]=queryCategory;
105 }
106 public String getQueryId()
107 {
108 return [Link];
109 }
110 public String getQueryCategory()
111 {
112 return [Link];
113 }
114
115 }
[Link]
1 import [Link].*;
2 public class TestApplication {
3 //Write the required business logic as expected in the question description
4 public static void main (String[] args) {
5 Scanner sc= new Scanner ([Link]);
6 Query q= new Query();
7 [Link] pd= [Link] DataSet();
8 [Link] sd= [Link] DataSet();
9 [Link]("Enter the Details for primary data set");
10 [Link]("Enter the theatre id");
11 [Link]([Link]());
12 [Link]("Enter the theatre name");
13 [Link]([Link]());
14 [Link]("Enter the location");
15 [Link]([Link]());
16 [Link]("Enter the no of screens");
17 [Link]([Link]());
18 [Link]("Enter the ticket cost");
19 [Link]([Link]());
20 [Link]("Enter the Details for secondary data set");
21 [Link]("Enter the theatre id");
22
23 String id2=[Link]();
24 //[Link](id2);
25 [Link](id2);
26 [Link]("Enter the theatre name");
27 [Link]();
28 [Link]([Link]());
29 [Link]("Enter the location");
30 String gll=[Link]();
31 [Link](gll);
32 [Link]("Enter the no of screens");
33
34 //[Link](gll);
35 //String pp=[Link]();
36 //[Link](pp);
37
38 [Link]([Link]());
39 [Link]("Enter the ticket cost");
40 [Link]([Link]());
41 [Link]();
42 [Link]("Enter the query id");
43 [Link]([Link]());
44 [Link]("Enter the query category");
45 [Link]([Link]());
46
47 [Link](sd);
48 [Link](pd);
49 [Link]([Link]());
50 }
51 }
Grade
Reviewed on Friday, 17 December 2021, 6:59 PM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
You being their software consultant have been approached by them to develop an application
which can be used for managing their business. You need to implement a java program to view
all the flight based on source and destination.
int
noOfSeats
double
flightFare
Note: The class and methods should be declared as public and all the attributes should be
declared as private.
Requirement 1: Retrieve all the flights with the given source and destination
The customer should have the facility to view flights which are from a particular source to
destination. Hence the system should fetch all the flight details for the given source and
destination from the database. Those flight details should be added to a ArrayList and return the
same.
The flight table is already created at the backend. The structure of flight table is:
Column Name Datatype
flightId int
source varchar2(30)
destination varchar2(30)
noofseats int
flightfare number(8,2)
To connect to the database you are provided with [Link] file and [Link] file. (Do
not change any values in [Link] file)
Create a class called Main with the main method and get the inputs
like source and destination from the user.
Display the details of flight such as flightId, noofseats and flightfare for all the flights returned
as ArrayList<Flight> from the
method viewFlightBySourceDestination in FlightManagementSystem class.
If no flight is available in the list, the output should be “No flights available for the given source
and destination”.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the remaining text represents the output.
Malaysia
Singapore
Malaysia
Dubai
Automatic evaluation[+]
[Link]
1
2 public class Flight {
3
4 private int flightId;
5 private String source;
6 private String destination;
7 private int noOfSeats;
8 private double flightFare;
9 public int getFlightId() {
10 return flightId;
11 }
12 public void setFlightId(int flightId) {
13 [Link] = flightId;
14 }
15 public String getSource() {
16 return source;
17 }
18 public void setSource(String source) {
19 [Link] = source;
20 }
21 public String getDestination() {
22 return destination;
23 }
24 public void setDestination(String destination) {
25 [Link] = destination;
26 }
27 public int getNoOfSeats() {
28 return noOfSeats;
29 }
30 public void setNoOfSeats(int noOfSeats) {
31 [Link] = noOfSeats;
32 }
33 public double getFlightFare() {
34 return flightFare;
35 }
36 public void setFlightFare(double flightFare) {
37 [Link] = flightFare;
38 }
39 public Flight(int flightId, String source, String destination,
40 int noOfSeats, double flightFare) {
41 super();
42 [Link] = flightId;
43 [Link] = source;
44 [Link] = destination;
45 [Link] = noOfSeats;
46 [Link] = flightFare;
47 }
48
49
50
51 }
52
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7 public class FlightManagementSystem {
8 public ArrayList <Flight> viewFlightBySourceDestination(String source,String destination){
9 Connection conn = null;
10 ResultSet Rs = null;
11 String sql = "select * from flight where source=? and destination=? order by flightid";
12 ArrayList<Flight> flight = new ArrayList<>();
13 try{
14 conn = [Link]();
15 PreparedStatement ps = [Link](sql);
16
17 [Link](1, source);
18 [Link](2, destination);
19
20 Rs=[Link]();
21 while([Link]()){
22 Flight F = new Flight([Link](1),source,destination,[Link](4),[Link](5));
23 [Link](F);
24 }
25 }catch(ClassNotFoundException e){
26 [Link]();
27 }catch(SQLException e){
28 [Link]();
29 }
30
31 return flight;
32 }
33 }
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4
5
6 public class Main{
7 public static void main(String[] args){
8 Scanner sc=new Scanner([Link]);
9 // fill your code here
10 [Link]("Enter the source");
11 String source=[Link]();
12 [Link]("Enter the destination");
13 String destination=[Link]();
14 ArrayList<Flight> flight = new
FlightManagementSystem().viewFlightBySourceDestination(source,destination);
15 if([Link]())
16 {
17 [Link]("No flights available for the given source and destination");
18
19 }
20 else
21 {
22 [Link]("Flightid Noofseats Flightfare");
23 for(Flight f : flight)
24 {
25 [Link]([Link]()+" "+[Link]()+" "+[Link]());
26 }
27 }
28
29
30 }
31 }
[Link]
1 import [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7
8 public class DB {
9
10 private static Connection con = null;
11 private static Properties props = new Properties();
12
13
14 //ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
15 public static Connection getConnection() throws ClassNotFoundException, SQLException {
16 try{
17
18 FileInputStream fis = null;
19 fis = new FileInputStream("[Link]");
20 [Link](fis);
21
22 // load the Driver Class
23 [Link]([Link]("DB_DRIVER_CLASS"));
24
25 // create the connection now
26 con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),[Link]
operty("DB_PASSWORD"));
27 }
28 catch(IOException e){
29 [Link]();
30 }
31 return con;
32 }
33 }
34
[Link]
1 #IF NEEDED, YOU CAN MODIFY THIS PROPERTY FILE
2 #ENSURE YOU ARE NOT CHANGING THE NAME OF THE PROPERTY
3 #YOU CAN CHANGE THE VALUE OF THE PROPERTY
4 #LOAD THE DETAILS OF DRIVER CLASS, URL, USERNAME AND PASSWORD IN [Link] using this
properties file only.
5 #Do not hard code the values in [Link].
6
7 DB_DRIVER_CLASS=[Link]
8 DB_URL=jdbc:mysql://localhost:3306/${sys:DB_USERNAME}
9 DB_USERNAME=${sys:DB_USERNAME}
10 DB_PASSWORD=${sys:DB_USERNAME}
11
Grade
Reviewed on Wednesday, 12 May 2021, 6:31 AM by Automatic grade
Grade 100 / 100
Assessment report
[+]Grading and Feedback
CLUB MEMBER DETAILS
[Link]*
[Link] = memberId;
return memberId;
[Link] = memberName;
return memberName;
[Link] = memberType;
return memberType;
return membershipFees;
[Link] = memberId;
[Link] = memberName;
[Link] = memberType;
[Link]*
import [Link];
[Link]();
[Link]("Enter Name");
[Link]();
}
CreditCardValidator
[Link]*
package [Link];
public CreditCard() {
super();
[Link] = number;
return number;
[Link] = number;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
//check whether the card is blocklisted and card contains only 16 digits
String msg=null;
if(validateAgainstBlocklist(card, fileName))
msg="Card is blocked";
else if(validateNumber([Link]()))
else
msg="valid card";
return msg;
if([Link]().equalsIgnoreCase(str2) || [Link]().equalsIgnoreCase(str3))
{
bol=true;
else{
bol=false;
return bol;
boolean bol=true;
if(len!=16)
bol=true;
else{
bol=false;
return bol;
// Get the blocklisted no's from the file and return list of numbers
for(int i=0;i<[Link];i++)
[Link](dig1[i]);
}
return li;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"validate:String,validateAgainstBlocklist:boolean,validateNumber:boolean,getBlockListNumbers:List","com.c
[Link]");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class name/package. Use the correct package "
} catch (Exception e) {
[Link]([Link], "There is an error in validating the " + "Class Name. Please manually verify that the "
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if (!([Link]().getSimpleName().equals(returnType))) {
errorFlag = true;
[Link]([Link], " You have changed the " + "return type in '" + methodName
+ "' method. Please stick to the " + "skeleton provided");
} else {
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the given public method " + methodName
+ ". Do not change the " + "given public method name. " +
"Verify it with the skeleton");
if (!errorFlag) {
} catch (Exception e) {
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
[Link](cardNumber);
//Write your code here read card numnber and create CreditCard object based on cardnumber
[Link](validationMessage);
}
ESHOPPING
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
[Link]([Link](amt));
}
[Link]*/orderService
package [Link];
import [Link];
/**
*/
/**
* Method to calculate total purchase amount for all the order line items
* @param orderLineItems
* @return totalOrderAmount
*/
double totalOrderAmount = 0;
int qt =0;
for(int i=0;i<[Link];i++){
qt = orderLineItems[i].quantity;
cost = orderLineItems[i].itemCostPerQuantity;
totalOrderAmount += (qt*cost);
/**
* @param totalOrderAmount
* @return discount
*/
if(totalOrderAmount<1000){
discount = (totalOrderAmount*10)/100;
discount = (totalOrderAmount*20)/100;
else if(totalOrderAmount>=10000){
discount = (totalOrderAmount*30)/100;
/**
* Method to verify if the order line item is flagged as Bulk Order or not
* @param lineItem
* @return boolean
*/
boolean result=false;
if([Link]>5){
result = true;
result=false;
}
/**
* @param orderLineItems
* @return
*/
int count = 0;
for(int i=0;i<[Link];i++){
if(isBulkOrder(orderLineItems[i])){
count++;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author 222805
* This class is used to verify if the Code Skeleton is intact and not modified by participants thereby ensuring smooth
auto evaluation
*/
public class SkeletonValidator {
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"calculateOrderTotalAmount:double,calculateDiscount:double,isBulkOrder:boolean,countOfBulkOrderLineIt
ems:int",
"[Link]");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class name/package. Use the correct package "
} catch (Exception e) {
return iscorrect;
}
protected final void validateMethodSignature(String methodWithExcptn, String className) {
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if (!([Link]().getName().equals(returnType))) {
errorFlag = true;
[Link]([Link], " You have changed the " + "return type in '" + methodName
+ "' method. Please stick to the " + "skeleton provided");
} else {
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the given public method " + methodName
+ ". Do not change the " + "given public method name. " + "Verify it with the skeleton");
if (!errorFlag) {
} catch (Exception e) {
[Link]*
package [Link];
/**
*/
return itemId;
}
public void setItemId(String itemId){
[Link] = itemId;
return itemName;
[Link] = itemName;
return itemCostPerQuantity;
[Link] = itemCostPerQuantity;
return quantity;
[Link] = quantity;
[Link] = itemId;
[Link] = itemName;
[Link]=itemCostPerQuantity;
[Link] = quantity;
}
Fixed Deposit Details
[Link]*
import [Link].*;
class FDScheme{
super();
[Link]=schemeNo;
[Link]=depositAmt;
[Link]=period;
calculateInterestRate();
return schemeNo;
[Link]=schemeNo;
return depositAmt;
[Link]=depositAmt;
return period;
return rate;
[Link]=rate;
[Link]=(float)5.5;
[Link]=(float)6.25;
[Link]=(float)7.5;
[Link]*
import [Link];
int no=[Link]();
[Link]();
double amt=[Link]();
int prd=[Link]();
FDScheme obj=new
FDScheme(no,amt,prd);
}
GPA CALCULATION
[Link]*
package [Link];
import [Link].*;
import [Link].*;
[Link](new ArrayList<Integer>());
int option=0;
double gpa1=0;
do
option = [Link]([Link]());
switch(option)
[Link](grade);
break;
if(gpa1 > 0)
[Link]("GPA Scored");
[Link](gpa1);
else
break;
case 3 : break;
}while(option!=3);
[Link]*
package [Link];
import [Link].*;
return gradePointList;
[Link] = gradePointList;
/*This method should add equivalent grade points based on the grade obtained by the student passed as
argument into gradePointList
Grade S A B C D E
Grade Point 10 9 8 7 6 5
For example if the gradeobtained is A, its equivalent grade points is 9 has to added into the
gradePointList*/
public void addGradePoint(char gradeObtained) {
if(gradeObtained == 'S')
[Link](10);
[Link](9);
[Link](8);
[Link](7);
[Link](6);
else
[Link](5);
/* This method should return the GPA of all grades scored in the semester
For Example:
double gpa=-1;
double total=0,value=0,size=0;
size = [Link]();
if(size < 1)
return 0;
Iterator i = [Link]();
while([Link]())
value = (Integer)[Link]();
total += value;
gpa = total/size;
return gpa;
}
HUNGER EATS
[Link]*
package [Link];
return foodId;
[Link] = foodId;
return foodName;
[Link] = foodName;
return costPerUnit;
[Link] = costPerUnit;
return quantity;
[Link] = quantity;
}
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
int itemno;
String bank;
itemno=[Link]();
for(int i=0;i<itemno;i++){
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
[Link](fd);
}
[Link]("Enter the bank name to avail offer");
bank=[Link]();
[Link](bank);
[Link]*
package [Link];
import [Link].*;
import [Link];
return discountPercentage;
[Link] = discountPercentage;
return foodList;
[Link] = foodList;
}
//This method should set the discount percentage based on bank passed as argument
if([Link]("HDFC")){
discountPercentage=15.0;
else if([Link]("ICICI")){
discountPercentage=25.0;
else if([Link]("CUB")){
discountPercentage=30.0;
else if([Link]("SBI")){
discountPercentage=50.0;
else if([Link]("OTHERS")){
discountPercentage=0.0;
//This method should add the FoodProduct Object into Food List
List<FoodProduct> f=getFoodList();
[Link](foodProductObject);
setFoodList(f);
double bill=0;
List<FoodProduct> f=getFoodList();
for(int i=0;i<[Link]();i++){
//
// [Link]([Link](i).getCostPerUnit());
//
// [Link]([Link](i).getQuantity());
bill+=[Link](i).getQuantity()*[Link](i).getCostPerUnit()*1.0;
bill=bill-((bill*discountPercentage)/100);
return bill;
}
INSURANCE PREMIUM GENERATOR
[Link]*
package [Link];
public PropertyDetails() {
return builtUpArea;
[Link] = builtUpArea;
return builtYear;
[Link] = builtYear;
[Link] = reconstructionCost;
return householdValuation;
[Link] = householdValuation;
return burglaryCoverReqd;
[Link] = burglaryCoverReqd;
return politicalUnrestCoverReqd;
[Link] = politicalUnrestCoverReqd;
return sumAssured;
}
public void setSumAssured(Integer sumAssured) {
[Link] = sumAssured;
super();
[Link] = builtUpArea;
[Link]=builtYear;
[Link] = reconstructionCost;
[Link] = householdValuation;
[Link] = burglaryCoverReqd;
[Link] = politicalUnrestCoverReqd;
[Link]*
package [Link];
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
double amountToBePaid = 0;
double additionalAmount1=0;
double additionalAmount2=0;
* calculatePremiumForPoliticalUnrestCoverage(propertyDetails, amountToBePaid)
* else return 0;
*/
if(!validatePropertyParameters(propertyDetails)) {
return 0;
amountToBePaid=calculatePremiumByPropertyAge(propertyDetails);
additionalAmount1=calculatePremiumForBurglaryCoverage(propertyDetails, amountToBePaid);
additionalAmount2=calculatePremiumForPoliticalUnrestCoverage(propertyDetails,
amountToBePaid);
return [Link](amountToBePaid+additionalAmount1+additionalAmount2);
}
/*
* conditions to be checked
*/
return false;
return false;
return true;
//Use Constants.MIN_PREMIUM_AMOUNT
int sumAssured =
[Link]()*[Link]()+[Link](
);
[Link](sumAssured);
double premium = 0;
if(propertyAge>15) {
premium = Constants.MIN_PREMIUM_AMOUNT+([Link]()*0.35);
else if(propertyAge>=6) {
premium = Constants.MIN_PREMIUM_AMOUNT+([Link]()*0.2);
else {
premium = Constants.MIN_PREMIUM_AMOUNT+([Link]()*0.1);
return premium;
if([Link]().equalsIgnoreCase([Link])) {
return amount*.01;
return 0;
//Ex:-[Link]().equalsIgnoreCase([Link]) to check
condition
if([Link]().equalsIgnoreCase([Link])) {
return amount*.01;
return 0;
}
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author
* This class is used to verify if the Code Skeleton is intact and not modified by participants thereby ensuring smooth
auto evaluation
*/
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"checkOwnerDetails:boolean,getPremiumAmount:double,validatePropertyParameters:boolean,calculatePre
miumByPropertyAge:double,calculatePremiumForBurglaryCoverage:double,calculatePremiumForPoliticalUnrestCov
erage:double","[Link]");
try {
[Link](className);
iscorrect = true;
[Link]("Class Name " + className + " is correct");
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class name/package. Use the
correct package "+ "and class name as provided in the skeleton");
} catch (Exception e) {
[Link]([Link],
"There is an error in validating the " + "Class Name. Please manually verify that the "
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
foundMethod = true;
if (!([Link]().getSimpleName().equals(returnType))) {
errorFlag = true;
[Link]([Link], " You have changed the " + "return type in '" +
methodName+ "' method. Please stick to the " + "skeleton provided");
} else {
if (!foundMethod) {
errorFlag = true;
[Link]([Link], " Unable to find the given public method " + methodName
+ ". Do not change the " + "given public method name. " + "Verify it with the
skeleton");
if (!errorFlag) {
} catch (Exception e) {
}
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
Integer builtUpArea = 0;
Integer builtYear=0;
Integer reconstructionCost = 0;
//read name
name = [Link]();
//read mobile
mobile = [Link]();
if([Link](name, mobile)) {
//read builtUpArea
builtUpArea = [Link]([Link]());
//read builtYear
builtYear = [Link]([Link]());
//read reconstructionCost
reconstructionCost = [Link]([Link]());
[Link](
"Do you want to include valuation of HouseHold Articles? Please provide yes/no");
//read response
if([Link]("yes")) {
//read householdValuation
householdValuation = [Link]([Link]());
burglaryCoverReqd = [Link]();
[Link]("Do you want to include Political unrest cover? Please provide yes/no");
//read politicalUnrestCoverReqd
politicalUnrestCoverReqd = [Link]();
if(premiumAmount==0.0) {
}else {
}
NUMEROLOGY NUMBER
[Link]*
import [Link];
int sum = 0;
return sum;
while ([Link]() != 1) {
string = [Link](getSum([Link](string)));
return [Link](string);
int oddCount = 0;
if ([Link](ch, 10) % 2 != 0) {
++oddCount;
}
return oddCount;
int evenCount = 0;
if ([Link](ch, 10) % 2 == 0) {
++evenCount;
return evenCount;
[Link]("Sum of digits");
[Link](getSum(num));
[Link]("Numerology number");
[Link](getNumerology(num));
[Link](getOddCount(num));
[Link](getEvenCount(num));
}
OIL STORES
[Link]*
import [Link];
[Link]=name;
[Link]=pack;
[Link]=category;
[Link]=cost;
[Link]=name;
return name;
[Link]=pack;
return pack;
[Link]=category;
return category;
}
[Link]=cost;
return cost;
float price=((qty*1000)/pack)*cost;
return price;
[Link]*
import [Link];
String n=[Link]();
int pc=[Link]();
[Link]("Enter category");
char cat=[Link]().charAt(0);
[Link]("Enter cost");
float c=[Link]();
[Link](n);
[Link](pc);
[Link](cat);
[Link](c);
float qty=[Link]();
}
PAYMENT-INHERITENCE
[Link]*
Cheque cheque=(Cheque)payObj;
if([Link]())
Cash cash=(Cash)payObj;
if([Link]())
Credit credit=(Credit)payObj;
if([Link]())
result="Payment done successfully via credit card. Remaining amount in your "+[Link]()+" card
is "+[Link]();
return result;
}
[Link]*
return cashAmount;
[Link] = cashAmount;
[Link]
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link] = chequeNo;
return chequeAmount;
[Link] = chequeAmount;
return dateOfIssue;
[Link] = dateOfIssue;
[Link](date);
return ([Link]([Link]))*12+([Link]([Link]));
@Override
int months=findDifference(getDateOfIssue());
return (getChequeAmount()>=getDueAmount()&months<=6);
try{
catch(ParseException e)
[Link]();
[Link]*
return creditCardNo;
[Link] = creditCardNo;
return cardType;
[Link] = cardType;
return creditCardAmount;
super();
public Credit()
@Override
int tax=0;
boolean isDeducted=false;
switch(cardType)
tax=(int)(0.02*getDueAmount())+getDueAmount();
if(tax<=getCreditCardAmount())
setCreditCardAmount(getCreditCardAmount()-tax);
isDeducted=true;
break;
tax=(int)(0.05*getDueAmount())+getDueAmount();
if(tax<=getCreditCardAmount())
{
setCreditCardAmount(getCreditCardAmount()-tax);
isDeducted=true;
break;
tax=(int)(0.1*getDueAmount())+getDueAmount();
if(tax<=getCreditCardAmount())
setCreditCardAmount(getCreditCardAmount()-tax);
isDeducted=true;
break;
return isDeducted;
[Link]*
return dueAmount;
[Link] = dueamount;
return false;
}
[Link]*
import [Link].*;
int dueAmount=[Link]();
String mode=[Link]();
switch(mode)
int cashAmount=[Link]();
[Link](cashAmount);
[Link](dueAmount);
[Link]([Link](cash));
break;
String number=[Link]();
int chequeAmount=[Link]();
String date=[Link]();
[Link](chequeAmount);
[Link](number);
[Link](date);
[Link](dueAmount);
[Link]([Link](cheque));
break;
String cardType=[Link]();
[Link](cardType);
[Link](creditNumber);
[Link](dueAmount);
[Link]([Link](credit));
break;
default:
break;
[Link]();
}
POWER PROGRESS
[Link]*
import [Link].*;
int m=[Link]();
if(m<=0){
[Link](""+m+" is an invalid");
return;
int n=[Link]();
if(n<=0){
[Link](""+n+" is an invalid");
return;
if(m>=n){
return;
for(int i=1;i<=n;i++){
[Link]((int)[Link](m,i)+" ");
}
PRIME NUMBERS ENDING WITH 1
[Link]*
import [Link];
int last=0;
int flag = 0;
low = [Link]();
high = [Link]();
else {
int i = low;
int x = i % 10;
if (i % j != 0 && x == 1) {
flag = 1;
} else {
flag = 0;
break;
if (flag == 1 )
[Link](i);
i++;
}}}
SINGAPORE TOURISM
[Link]*
import [Link].*;
[Link]("BEACH",270);
[Link]("PILGRIMAGE",350);
[Link]("HERITAGE",430);
[Link]("HILLS",780);
[Link]("FALLS",1200);
[Link]("ADVENTURES",4500);
String pname=[Link]();
String name=[Link]();
if())
else
int nod=[Link]();
if(nod<=0)
else
if(not<=0)
else
double d=(double)[Link]([Link]());
double totalcost=d*(double)not*(double)nod;
if(totalcost>=1000)
totalcost=totalcost-((totalcost*15)/100);
}
SUBSTITUTION CYPHER TECHNIQUE
[Link]*
import [Link];
int shift = 7;
int f=0;
f=1;
alpha=(char)(alpha - shift);
decryptMessage=decryptMessage+alpha;
f=1;
alpha=(char)(alpha - shift);
decryptMessage=decryptMessage+alpha;
decryptMessage=decryptMessage+alpha;
}
if([Link]() == 0 || f == 0){
[Link](0);
[Link]("Decrpted Text:\n"+decryptMessage);
}
ZEE ZEE BANK
[Link]*
long accountNumber;
double balanceAmount;
super();
[Link]=accno;
[Link]=bal;
return accountNumber;
[Link]=accno;
return balanceAmount;
[Link]=bal;
float total=(float)(balanceAmount+depositAmt);
balanceAmount=total;
float total;
if(withdrawAmt>balanceAmount){
[Link]("Insufficient balance");
return false;
}else{
total=(float)(balanceAmount-withdrawAmt);
setBalanceAmount(total);
return true;
[Link]*
import [Link];
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
[Link]();
[Link]([Link]());
}
THE NEXT RECHARGE DATE
[Link]*
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link]("Recharged date");
String date=[Link]();
String currentDate="29/10/2019";
if([Link](date)&&([Link](date,currentDate))){
[Link]("Validity days");
int days=[Link]([Link]());
if(days>0)
[Link]([Link](date,days));
else
else
String regex="^(3[01]|[12][0-9]|0[1-9])/(1[0-2]|0[1-9])/[0-9]{4}$";
Pattern pattern=[Link](regex);
Matcher matcher=[Link]((CharSequence)date);
return [Link]();
}
Date d1=[Link](date1);
Date d2=[Link](date2);
if(([Link](d2)<0)||([Link](d2)==0))
return true;
else
return false;
Calendar c=[Link]();
try{
Date mydate=[Link](date);
[Link](mydate);
[Link]([Link], days);
}catch(ParseException e){
[Link]();
String toDate=[Link]([Link]());
return toDate;
}
A New You Spa
[Link]*
super(customerId,customerName,mobileNumber,memberType,emailId);
/*[Link] = customerId;
[Link] = customerName;
[Link] = mobileNumber;
[Link] = memberType;
[Link] = emailId;*/
boolean b=true;
String s1 = [Link]();
String regex="[DIAMOND]{7}[0-9]{3}";
if([Link](regex)){
b=true;
else{
b=false;
return b;
double updateamount=purchaseAmount-discount;
return updateamount;
[Link]*
super(customerId,customerName,mobileNumber,memberType,emailId);
boolean b=true;
String s1 = [Link]();
String regex="[GOLD]{4}[0-9]{3}";
if([Link](regex)){
b=true;
else{
b=false;
return b;
double discount=purchaseAmount*0.15;
double updateamount=purchaseAmount-discount;
return updateamount;
}
[Link]*
return customerId;
[Link] = customerId;
return customerName;
[Link] = customerName;
return mobileNumber;
[Link] = mobileNumber;
return memberType;
return emailId;
[Link] = emailId;
public Members(String customerId, String customerName, long mobileNumber, String memberType, String
emailId) {
[Link] = customerId;
[Link] = customerName;
[Link] = mobileNumber;
[Link] = memberType;
[Link] = emailId;
[Link]*
super(customerId,customerName,mobileNumber,memberType,emailId);
/*customerId = customerId;
customerName = customerName;
mobileNumber = mobileNumber;
memberType = memberType;
emailId = emailId;
*/
}
public boolean validateCusomerId(){
boolean b=true;
String s1 = [Link]();
String regex="[PLATINUM]{8}[0-9]{3}";
if([Link](regex)){
b=true;
else{
b=false;
return b;
double discount=purchaseAmount*0.3;
double updateamount=purchaseAmount-discount;
return updateamount;
[Link]*
import [Link];
String cname=[Link]();
long mob=[Link]();
[Link]();
String mem=[Link]();
String email=[Link]();
double amount=[Link]();
double res=0.0;
if([Link]()){
res= [Link](amount);
[Link]("Name :"+[Link]());
[Link]("Id :"+[Link]());
[Link]("Email Id :"+[Link]());
} else if([Link]()){
res= [Link](amount);
[Link]("Name :"+[Link]());
[Link]("Id :"+[Link]());
[Link]("Email Id :"+[Link]());
} else if([Link]()){
res= [Link](amount);
[Link]("Name :"+[Link]());
[Link]("Id :"+[Link]());
[Link]("Email Id :"+[Link]());
} else{
}
BATTING AVERAGE
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
[Link](new ArrayList<>());
boolean flag=true;
while(flag)
[Link]("3. Exit");
int choice=[Link]();
switch(choice)
case 1: {
int runScored=[Link]();
[Link](runScored);
break;
case 2: {
[Link]([Link]());
break;
}
case 3: {
flag=false;
break;
[Link]*
package [Link];
import [Link];
return scoreList;
[Link] = scoreList;
//This method should add the runScored passed as the argument into the scoreList
[Link](runScored);
/* This method should return the average runs scored by the player
Average runs can be calculated based on the sum of all runScored available in the scoreList divided by the
number of elements in the scoreList.
For Example:
List contains[150,50,50]
*/
if([Link]()) {
return 0.0;
int size=[Link]();
int totalScore=0;
totalScore+=score;
}
Change The Cash
[Link]*
import [Link].*;
String a = [Link]();
if([Link]() < 3) {
return;
return;
int j = 0;
arr1[j++] = arr[i];
if(j!=0) {
[Link](arr1[i]);
return;
char b = [Link]().charAt(0);
int present = 0;
if(arr[i] == [Link](b)) {
arr[i] = [Link](b);
present = 1;
arr[i] = [Link](b);
present = 1;
if(present == 0) {
else {
[Link](arr[i]);
}
Check Number Type
[Link]*
[Link]*
import [Link];
int n=[Link]();
if(isOdd().checkNumberType(n))
[Link](n+" is odd");
else
}
Cheque Payment Process
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
connection=[Link]();
PreparedStatement statement=null;
ResultSet resultSet=null;
try {
resultSet=[Link]();
while([Link]()){
[Link]([Link]("customerNumber"));
[Link]([Link]("chequeNumber"));
[Link]([Link]("paymentDate"));
[Link]([Link]("amount"));
[Link](payment);
}
} catch (SQLException e) {
[Link]();
}finally{
try{
[Link]();
[Link]();
}catch(Exception e){
[Link]();
} }
return paymentList;
[Link]*
package [Link];
import [Link];
return customerNumber;
}
public void setCustomerNumber(int customerNumber) {
[Link] = customerNumber;
return chequeNumber;
[Link] = chequeNumber;
return paymentDate;
[Link] = paymentDate;
return amount;
[Link] = amount;
@Override
}
[Link]*
package [Link];
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
List<Payment> list=[Link]();
list2 = [Link]().filter(x->[Link]()==customerNumber).collect([Link]());
return list2;
List<Payment> list=[Link]();
list2 = [Link]().filter(x->[Link]().getYear()==(year-
1900)).sorted([Link](Payment::getAmount)).collect([Link]());
return list2;
}
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
public SkeletonValidator(){
validateClassName("[Link]");
validateMethodSignature("getAllRecord:[Link]","[Link]");
validateClassName("[Link]");
validateMethodSignature("toString:[Link]","[Link]");
validateClassName("[Link]");
validateMethodSignature("findCustomerByNumber:[Link],findCustomerByYear:[Link]","[Link].
[Link]");
validateClassName("[Link]");
validateMethodSignature("getConnection:[Link]","[Link]")
;
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class name/package. Use the
correct package "
} catch (Exception e) {
[Link]([Link],
"There is an error in validating the " + "Class Name. Please manually verify
that the "
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if (!([Link]().getName().equals(returnType))) {
errorFlag = true;
} else {
if (!foundMethod) {
errorFlag = true;
+ ". Do not change the " + "given public method name. " +
"Verify it with the skeleton");
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
" There is an error in validating the " + "method structure. Please manually
verify that the "
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
private DatabaseUtil() {
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
try{
FileInputStream fis = null;
[Link](fis);
try {
[Link]([Link]("DB_DRIVER_CLASS"));
} catch (ClassNotFoundException e) {
[Link]();
try {
con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),[Link]
y("DB_PASSWORD"));
} catch (SQLException e) {
[Link]();
catch(IOException e){
[Link]();
return con;
}
[Link](Main)*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
Payment payment=null;
do{
[Link]("Select Option:");
int choice=[Link]();
switch(choice){
int number=[Link]();
if([Link]()==0){
}else{
[Link]("%15s%15s%15s%15s\n","Customer Number","Cheque Number","Payment
Date","Amount");
[Link]()
.forEach([Link]::println);
break;
int year=[Link]();
if([Link]()==0){
}else{
[Link]()
.forEach([Link]::println);
break;
case 3:[Link](0);
default:[Link]("\nWrong Choice\n");
}while(true);
}
Employee Eligibility for Promotion
[Link]*
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
//[Link]("In-time");
String fdt=[Link](formatter);
// [Link](fdt);
int no = [Link]();
String id = [Link]();
[Link](id, date);
}
int count = 0;
int val = 0;
if ([Link]().matches("(0[1-9]|[1-2][0-9]|3[0-1])/(0[1-9]|1[0-2])/[0-9]{4}"))
val++;
if (lin >= 5)
count++;
[Link]([Link]());
else
break;
}
Exam Scheduler
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link];
if(assessments==null || [Link]()) {
int rowsCount = 0;
try{
for(Assessment a:assessments)
[Link](1,[Link]());
[Link](2,[Link]());
[Link](3,[Link]().toString());
[Link](4,[Link]().toString());
[Link](5,[Link]().toString());
[Link](6,[Link]().toString());
int rs=[Link]();
if(rs!=-1)
rowsCount=rowsCount+1;
} catch(SQLException e){
return rowsCount;
PreparedStatement ps = [Link](sql);
[Link](1, code);
ResultSet rs = [Link]();
if([Link]()) {
[Link]([Link](1));
[Link]([Link](2));
[Link]([Link]([Link](3)));
[Link]([Link]([Link](4)));
[Link]([Link]([Link](5)));
[Link]([Link]([Link](6)));
return assessment;
}
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
String temp[]=[Link](",");
Assessment a = new
Assessment(temp[0],temp[1],[Link](temp[2]),[Link](temp[3]),[Link](temp[4]),Period.p
arse(temp[5]));
return a;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public Assessment(String examCode, String examTitle, LocalDate examDate, LocalTime examTime, Duration
examDuration,
Period evalDays) {
super();
[Link] = examCode;
[Link] = examTitle;
[Link] = examDate;
[Link] = examTime;
[Link] = examDuration;
[Link] = evalDays;
public Assessment() {
return examCode;
[Link] = examCode;
return examTitle;
}
public void setExamTitle(String examTitle) {
[Link] = examTitle;
return examDate;
[Link] = examDate;
return examTime;
[Link] = examTime;
return examDuration;
[Link] = examDuration;
return evalDays;
[Link] = evalDays;
}
DateTimeFormatter date1=[Link]("dd-MMM-y");
DateTimeFormatter date2=[Link]("HH:mm");
LocalTime t=[Link](examDuration);
String d=[Link]("HH:mm").format(t);
LocalDate t1=[Link](evalDays);
String d1=[Link]("dd-MMM-y").format(t1);
[Link]("Title: "+examTitle);
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
try{
[Link](fis);
[Link]([Link]("DB_DRIVER_CLASS"));
con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),[Link]
y("DB_PASSWORD"));
catch(IOException e){
[Link]();
return con;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link].*;
import [Link];
import [Link];
String line="";
list=new ArrayList<Assessment>();
while((line=[Link]())!=null)
[Link]([Link](line));
return list;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public SkeletonValidator() {
[Link] };
testClass(assessmentClass, assessmentParams);
testClass(assessmentDAOClass, null);
testClass(funtionalClass, null);
testClass(databaseUtilClass, null);
testClass(fileUtilClass, null);
testFields(assessmentClass, assessmentFields);
try {
[Link](constructor);
} catch (ClassNotFoundException e) {
+ "Use the correct package and class name as provided in the skeleton");
} catch (NoSuchMethodException e) {
+ "Do not change the given public constructor. " + "Verify it with the
skeleton");
} catch (SecurityException e) {
[Link]([Link],
"There is an error in validating the " + className + ". " + "Please verify the
skeleton manually");
try {
[Link](field);
} catch (ClassNotFoundException e) {
+ "Use the correct package and class name as provided in the skeleton");
} catch (NoSuchFieldException e) {
[Link]([Link],
"You have changed one/more field(s). " + "Use the field name(s) as provided
in the skeleton");
} catch (SecurityException e) {
[Link]([Link],
"There is an error in validating the " + className + ". " + "Please verify the
skeleton manually");
public void testMethods(String className, String methodName, Class[] paramTypes, Class returnType) {
try {
[Link]([Link], " You have changed the " + "return type in '" + methodName
} catch (ClassNotFoundException e) {
+ "Use the correct package and class name as provided in the skeleton");
} catch (NoSuchMethodException e) {
} catch (SecurityException e) {
[Link]([Link],
"There is an error in validating the " + className + ". " + "Please verify the
skeleton manually");
}
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
try {
[Link](assessments);
[Link]();
} catch (Exception e) {
[Link](e);
}
Book Details
[Link]*
import [Link];
if([Link]()==18)
int i1 = [Link](substr1);
int i2 = [Link](substr2);
//[Link](substr3);
int i3 = [Link](substr3);
if(i3>=10)
if(([Link](0)>='A'&&[Link](0)<='Z')||([Link](0)>='a'&&[Link](0)<='z'))
if(([Link](0)>='0'&&[Link](0)<='9')&&([Link](1)>='0'&&[Link](1)<='9')&&
([Link](2)>='0'&&[Link](2)<='9')&&([Link](3)>='0'&&[Link](3)<='9')&&
([Link](4)>='0'&&[Link](4)<='9'))
{
String substr6 = [Link](12,18);
if(i1==101)
else if(i1==102)
else if(i1==103)
else
[Link]("\n");
else
[Link]("\n");
else
[Link]("\n");
}
}
else
[Link]("\n");
else
[Link]("\n");
else
[Link]("\n");
}
Find Membership Category
[Link]*
return memberId;
[Link] = memberId;
return memberName;
[Link] = memberName;
return category;
[Link] = category;
super();
[Link] = memberId;
[Link] = memberName;
[Link] = category;
}
}
[Link]*
import [Link];
super();
[Link] = memberCategory;
[Link] = memberList;
return memberCategory;
[Link] = memberCategory;
}
public int getCount() {
return count;
[Link] = count;
return memberList;
[Link] = memberList;
synchronized(this)
for(Member m:memberList)
if([Link]().equals(memberCategory))
count++;
}
}
[Link]*
import [Link];
import [Link];
import [Link];
int tot=[Link]();
for(int i=0;i<[Link];i++)
str[i]=[Link]();
for(int i=0;i<[Link];i++)
String s[]=str[i].split(":");
m[i]=new Member(s[0],s[1],s[2]);
[Link](m[i]);
int tot1=[Link]();
for(int i=0;i<tot1;i++)
String s1=[Link]();
t1[i]=new ZEEShop(s1,mList);
t1[i].start();
//[Link](s1+" "+[Link]());
try {
[Link]().sleep(2000);
} catch (InterruptedException e) {
[Link]();
for(ZEEShop s:t1)
[Link]([Link]()+":"+[Link]());
}
Go Hospitals
[Link]*
public InPatient(String patientId, String patientName, long mobileNumber, String gender, double roomRent) {
super(patientId,patientName,mobileNumber,gender);
[Link]=roomRent;
return roomRent;
[Link] = roomRent;
double bill_amount;
bill_amount=(([Link]*noOfDays)+medicinalBill);
return bill_amount;
[Link]*
public OutPatient(String patientId, String patientName, long mobileNumber, String gender, double consultingFee)
{
super(patientId,patientName,mobileNumber,gender);
[Link]=consultingFee;
return consultingFee;
[Link] = consultingFee;
double bill_amount;
bill_amount=[Link]+scanPay+medicinalBill;
return bill_amount;
[Link]*
[Link] = patientId;
[Link] = patientName;
[Link] = mobileNumber;
[Link] = gender;
return patientId;
[Link] = patientId;
return patientName;
[Link] = patientName;
return mobileNumber;
[Link] = mobileNumber;
return gender;
[Link] = gender;
}
[Link]*
import [Link];
[Link]("[Link] Patient");
[Link]("[Link] Patient");
int ch=[Link]();
[Link]("Patient Id");
String id=[Link]();
[Link]("Patient Name");
String name=[Link]();
[Link]();
[Link]("Phone Number");
long num=[Link]();
[Link]("Gender");
String gen=[Link]();
if(ch==1){
[Link]("Room Rent");
double rent=[Link]();
[Link]("Medicinal Bill");
double bill=[Link]();
int days=[Link]();
else{
[Link]("Consultancy Fee");
double fee=[Link]();
[Link]("Medicinal Bill");
double medbill=[Link]();
[Link]("Scan Pay");
double pay=[Link]();
}
Grade Calculation
[Link]*
return studName;
[Link] = studName;
return result;
[Link] = result;
return marks;
[Link] = marks;
}
public GradeCalculator(String studName, int[] marks){
[Link] = studName;
[Link] = marks;
int sum = 0;
for(int i = 0;i<[Link];i++)
sum = sum+score[i];
if((400<=sum)&&(sum<=500))
[Link](getStudName()+":"+'A');
if((300<=sum)&&(sum<=399))
[Link](getStudName()+":"+'B');
if((200<=sum)&&(sum<=299))
[Link](getStudName()+":"+'C');
if(sum<200)
[Link](getStudName()+":"+'E');
[Link]*
import [Link];
import [Link];
import [Link];
int th = [Link]([Link]());
str = [Link]();
details[i]=str;
int k = 0;
arr[k++] = [Link](sp[j]);
[Link]();
try{
[Link](1000);
catch(Exception e)
[Link](e);
}
Passanger Amenity
[Link]*
import [Link];
int num,n,i,count1=0,count2=0,y;
char alpha,ch;
String n1,n2;
n=[Link]();
if(n<=0){
[Link](0);
for(i=0;i<n;i++,count1=0,count2=0){
arr1[i] =[Link]();
arr2[i]= [Link]();
num =[Link](arr2[i].substring(1,(arr2[i].length())));
alpha= arr2[i].charAt(0);
count2++;
for(ch=65;ch<84;ch++){
if(ch==alpha){
count1++;
if(count1==0){
[Link](""+alpha+" is invalid coach");
[Link](0);
if(count2==0){
[Link](0);
for(i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(arr2[i].charAt(0)==arr2[j].charAt(0)){
if(([Link](arr2[i].substring(1,(arr2[i].length()))))<([Link](arr2[j].substring(1,arr2[j].length())))){
n1=arr1[i];
n2=arr2[i];
arr1[i]=arr1[j];
arr2[i]=arr2[j];
arr1[j]=n1;
arr2[j]=n2;
else
if(arr2[i].charAt(0)<arr2[j].charAt(0))
n1=arr1[i];
n2=arr2[i];
arr1[i]=arr1[j];
arr2[i]=arr2[j];
arr1[j]=n1;
arr2[j]=n2;
}
for(i=0;i<n;i++){
String a=arr1[i].toUpperCase();
String b=arr2[i];
[Link](a+" "+b);
[Link]("");
}
Perform Calculation
[Link]*
[Link]*
import [Link];
int a = [Link]();
int b= [Link]();
return Perform_calculation;
return Perform_calculation;
return Perform_calculation;
}
float c = (float)a;
float d = (float)b;
return (c/d);
};
return Perform_calculation;
}
Query DataSet
[Link]*
@Override
String g="";
g+=("Theatre id : "+[Link]()+"\n");
g+=("Location :"+[Link]()+"\n");
g+=("Theatre id : "+[Link]()+"\n");
g+=("Location :"+[Link]()+"\n");
g+=("Query id : "+queryId+"\n");
return g;
}
public class DataSet{
return ticketCost;
ticketCost=a;
return noOfScreen;
noOfScreen=a;
return location;
location=a;
}
return theatreName;
theatreName=a;
return theatreId;
theatreId=a;
[Link]=pD;
return [Link];
[Link]=pD;
}
public DataSet getPrimaryDataSet()
return [Link];
[Link]=queryId;
[Link]=queryCategory;
return [Link];
return [Link];
[Link]*
import [Link].*;
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
String id2=[Link]();
// [Link](id2);
[Link](id2);
[Link]();
[Link]([Link]());
String gll=[Link]();
[Link](gll);
// [Link](gll);
// String pp=[Link]();
// [Link](pp);
[Link]([Link]());
[Link]([Link]());
[Link]();
[Link]([Link]());
[Link]([Link]());
[Link](sd);
[Link](pd);
[Link]([Link]());
}
Retrive Flight Based On Source And Destination
[Link]*
return flightId;
[Link] = flightId;
return source;
[Link] = source;
return destination;
[Link] = destination;
return noOfSeats;
[Link] = noOfSeats;
}
public double getFlightFare() {
return flightFare;
[Link] = flightFare;
super();
[Link] = flightId;
[Link] = source;
[Link] = destination;
[Link] = noOfSeats;
[Link] = flightFare;
[Link]*
import [Link];
import [Link].*;
try{
String query="SELECT * FROM flight WHERE source= '" + source + "' AND destination= '" + destination + "' ";
Statement st=[Link]();
while([Link]()){
String src=[Link](2);
String dst=[Link](3);
int noofseats=[Link](4);
double flightfare=[Link](5);
[Link]();
return flightList;
[Link]*
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class DB {
try{
[Link](fis);
[Link]([Link]("DB_DRIVER_CLASS"));
con =
[Link]([Link]("DB_URL"),[Link]("DB_USERNAME"),[Link]
y("DB_PASSWORD"));
catch(IOException e){
[Link]();
return con;
[Link]*
import [Link];
import [Link];
String source=[Link]();
String destination=[Link]();
FlightManagementSystem fms= new FlightManagementSystem();
ArrayList<Flight> flightList=[Link](source,destination);
if([Link]()){
return;
}
Silver Health Plan Insurance
[Link]
public FamilyInsurancePolicy(String clientName, String policyId, int age, long mobileNumber, String emailId) {
int count=0;
if([Link]("FAMILY"));
count++;
char ch[]=[Link]();
for(int i=6;i<9;i++)
count++;
if(count==4)
return true;
else
return false;
double amount=0;
amount=2500*months*no_of_members;
amount=5000*months*no_of_members;
else if (age>=60)
amount=10000*months*no_of_members;
return amount;
[Link]*
public IndividualInsurancePolicy(String clientName, String policyId, int age, long mobileNumber, String
emailId) {
int count=0;
if([Link]("SINGLE"));
count++;
char ch[]=[Link]();
for(int i=6;i<9;i++)
count++;
if(count==4)
return true;
else
return false;
double amount=0;
if(age>=5 && age<=25)
amount=2500*months;
amount=5000*months;
else if (age>=60)
amount=10000*months;
return amount;
[Link]*
return clientName;
[Link] = clientName;
return policyId;
[Link] = policyId;
return age;
return mobileNumber;
[Link] = mobileNumber;
return emailId;
[Link] = emailId;
public InsurancePolicies(String clientName, String policyId, int age, long mobileNumber, String emailId) {
super();
[Link] = clientName;
[Link] = policyId;
[Link] = age;
[Link] = mobileNumber;
[Link] = emailId;
[Link]*
public SeniorCitizenPolicy(String clientName, String policyId, int age, long mobileNumber, String emailId) {
int count=0;
if([Link]("SENIOR"));
count++;
char ch[]=[Link]();
for(int i=6;i<9;i++)
count++;
if(count==4)
return true;
else
return false;
double amount=0;
amount=0;
else if (age>=60)
amount=10000*months*no_of_members;
return amount;
[Link]*
import [Link];
{
Scanner sc=new Scanner([Link]);
String name=[Link]();
String id=[Link]();
int age=[Link]();
long mnum=[Link]();
String email=[Link]();
int month=[Link]();
double amount=0;
if([Link]("SINGLE"))
if([Link]())
//[Link]([Link]());
amount=[Link](month);
[Link]("Name :"+name);
[Link]("Email Id :"+email);
else
}
else if([Link]("FAMILY"))
if([Link]())
int num=[Link]();
amount=[Link](month,num);
[Link]("Name :"+name);
[Link]("Email Id :"+email);
else
else if([Link]("SENIOR"))
if([Link]())
int num=[Link]();
amount=[Link](month,num);
[Link]("Name :"+name);
[Link]("Email Id :"+email);
else
}
else
}
Travel Request System
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link].*;
//import [Link];
import [Link];
class DB{
//ENSURE YOU DON'T CHANGE THE BELOW CODE WHEN YOU SUBMIT
try{
[Link](fis);
[Link]([Link]("DB_DRIVER_CLASS"));
catch(IOException e){
[Link]();
return con;
/**
* @return list
*/
try{
Connection con=[Link]();
PreparedStatement ps=[Link](query);
[Link](1,sourceCity);
[Link](2,destinationCity);
ResultSet rs=[Link]();
while([Link]()){
String tid=[Link]("travelReqId");
[Link] date=[Link]("travelDate");
String apstat=[Link]("approvalStatus");
String sour=[Link]("sourceCity");
String des=[Link]("destinationCity");
double cost=[Link]("travelCost");
catch(ClassNotFoundException e){
[Link]();
catch(SQLException e ){
[Link]();
/**
* @return list
*/
double amount=0;
try{
Connection con=[Link]();
PreparedStatement ps1=[Link](query);
[Link](1,approvalStatus);
ResultSet rs1=[Link]();
while([Link]()){
amount+=[Link]("travelCost");
catch(ClassNotFoundException e){
[Link]();
}
catch(SQLException e){
[Link]();
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @return status
*/
if([Link]("Approved")||[Link]("Pending")){
return "valid";
/**
* @return status
*/
if(){
if([Link]("Pune")|| [Link]("Mumbai")||
[Link]("Chennai")|| [Link]("Bangalore")||
[Link]("Hydrabad")){
if([Link]("Pune")||
[Link]("Mumbai")||[Link]("Chennai")||
[Link]("Bangalore")|| [Link]("Hydrabad")){
return "valid";
else{
return "invalid";
else{
return "invalid";
else{
return "invalid";
/**
* @return listOfTravelRequest
*/
if([Link](sourceCity,destinationCity).contentEquals("valid")){
return [Link](sourceCity,destinationCity);
else{
return null;
}
}
/**
* @return totalCost
*/
if([Link](approvalStatus).equals("valid")){
return [Link](approvalStatus);
else{
return -1;
[Link]*
package [Link];
import [Link];
import [Link];
import [Link];
/**
* @author t-aarti3
* This class is used to verify if the Code Skeleton is intact and not
* */
public SkeletonValidator() {
validateClassName("[Link]");
validateClassName("[Link]");
validateMethodSignature(
"validateApprovalStatus:[Link],validateSourceAndDestination:[Link],getTravelDetails:java
.[Link],calculateTotalTravelCost:double",
"[Link]");
try {
[Link](className);
iscorrect = true;
} catch (ClassNotFoundException e) {
[Link]([Link], "You have changed either the " + "class name/package. Use the
correct package "
} catch (Exception e) {
[Link]([Link],
"There is an error in validating the " + "Class Name. Please manually verify
that the "
return iscorrect;
try {
String[] methodSignature;
methodSignature = [Link](":");
methodName = methodSignature[0];
returnType = methodSignature[1];
cls = [Link](className);
if ([Link]([Link]())) {
foundMethod = true;
if (!([Link]().getName().equals(returnType))) {
errorFlag = true;
} else {
if (!foundMethod) {
errorFlag = true;
+ ". Do not change the " + "given public method name. " +
"Verify it with the skeleton");
}
if (!errorFlag) {
} catch (Exception e) {
[Link]([Link],
" There is an error in validating the " + "method structure. Please manually
verify that the "
[Link]*
package [Link];
import [Link];
// member variables
public TravelRequest() {
super();
// parameterized constructor
super();
[Link] = travelReqId;
[Link] = travelDate;
[Link] = approvalStatus;
[Link] = sourceCity;
[Link] = destinationCity;
[Link] = travelCost;
// setter, getter
/**
*/
return travelReqId;
/**
* @param travelReqId
*/
[Link] = travelReqId;
/**
*/
return travelDate;
/**
* @param travelDate
*/
[Link] = travelDate;
/**
*/
return approvalStatus;
/**
* @param approvalStatus
*/
[Link] = approvalStatus;
/**
*/
return sourceCity;
/**
* @param sourceCity
*/
[Link] = sourceCity;
/**
return destinationCity;
/**
* @param destinationCity
*/
[Link] = destinationCity;
/**
*/
return travelCost;
/**
* @param travelCost
*/
[Link] = travelCost;
[Link]*
package [Link];
import [Link].*;
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
new SkeletonValidator();
String sourceCity=[Link]();
String destinationCity=[Link]();
String status=[Link]();
if([Link](sourceCity,destinationCity).equals("valid")){
if([Link]()){
[Link]("No travel request raised for given source and destination cities");
else{
for(TravelRequest t:ltr){
String d=[Link]([Link]());
}
else{
if([Link](status).contentEquals("valid")){
[Link]([Link](status));
else{
In the Gold Ticket validation, the ticket ID must contain the string 'GOLD'. Additionally, the ticket ID is considered valid if it contains numbers between index positions 4 to 6, inclusive, and each of these characters must be between '1' and '9'. If these conditions are met, the ticket ID is valid .
The SkeletonValidator checks for the presence of specific class names, such as 'PassengerCategorization', 'Passenger', 'InvalidCarrierException', and 'PassengerUtility'. It also validates method signatures like 'retrievePassenger_BySource:java.util.List' in 'PassengerCategorization', 'fetchPassenger:java.util.List' in 'PassengerUtility', and verifies that they conform to the expected signatures .
Customers can view flights by entering their source and destination in the FlightManagementSystem. This search uses the method 'viewFlightBySourceDestination' which queries the database for flights matching the provided source and destination, then returns a list of relevant Flight objects, displaying details such as Flight ID, available seats, and flight fare .
The incremented salary for an employee is calculated based on their years of experience. If the years of experience are between 1 and 5, a 15% increment is applied to the salary. For 6 to 10 years of experience, the increment is 30%. If the experience is between 11 and 15 years, the increment is 45%. This is done by multiplying the current salary with the corresponding increment percentage and adding it to the existing salary .
CalculatePremiumService uses the SkeletonValidator to ensure that method signatures such as 'checkOwnerDetails:boolean', 'getPremiumAmount:double', and others remain unchanged. The SkeletonValidator inspects classes and methods to ensure their signatures align with the skeleton or template provided, protecting the system integrity during auto-evaluation .
To deposit money into an account, the 'deposit' method of the Account class is used. This method takes the deposit amount as an argument and adds it to the current balance amount, thereby updating the account balance .
The calculateTicketCost method varies the ticket cost based on both the type of ticket (Gold, Platinum, or Silver) and the seating preference (AC or non-AC). For Gold tickets, if AC is preferred, it costs 500 per ticket; otherwise, 350. For Platinum tickets, the cost is 750 with AC and 600 without. For Silver tickets, it's 250 with AC and 100 without .
Transactions are processed by first displaying the account balance, followed by depositing the specified amount using the deposit method. The balance is then updated and displayed. Subsequently, the withdrawal method checks for sufficient balance to process the withdrawal amount and updates the balance accordingly if successful. This procedure ensures the balance reflects accurate transaction processing order .
An order is flagged as a bulk order if the quantity of the line item exceeds 5, determined using the 'isBulkOrder' method. This status impacts discounts, with additional percentage discounts applied based on the total order amount if bulk status is identified. Bulk orders contribute to the count of line items used in determining eligibility and applying discounts .
The museum management application requires components like the Visitor class with attributes such as visitor ID, name, mobile number, visiting date, and address. To analyze and manipulate the data, functionalities are provided to filter and view visitor details within given dates and those based above a specified address .