You are on page 1of 6

#Rider cycle booking:-

import java.util.*;

public class Main

public static void main(String[] args)

Scanner sc=new Scanner(System.in);

System.out.println("Enter Your Name");

String name=sc.nextLine();

boolean d=name.matches("[a-zA-Z]+");

if(!d)

System.out.println("Invalid Name");

else

System.out.println("Enter the time duration");

int dur=sc.nextInt();

if(dur>=1 && dur<=24)

System.out.println("List of payment options");

System.out.println("1) Visa card");

System.out.println("2) Rupay card");

System.out.println("3) Master card");

System.out.println("Choose an option");

int ch=sc.nextInt();

while(ch>3 || ch<0)

System.out.println("Try Again");
ch=sc.nextInt();

if(dur>=5 && ch==1)

double p=(dur*20)*0.80;

System.out.printf("Dear "+name+" your bill amount is %.2f",p);

else if(dur>=5 && ch==2)

double p=(dur*20)*0.85;

System.out.printf("Dear "+name+" your bill amount is %.2f",p);

else

double p=(dur*20);

System.out.printf("Dear "+name+" your bill amount is %.2f",p);

else

System.out.println("Invalid Time Duration");

Wimpy shop lucky:-


import java.util.*;

public class Main

public static void main(String[] args)

{
Scanner sc=new Scanner(System.in);

//Fill code here

System.out.println("Enter the Customer Name ");

String str = sc.next();

System.out.println("Enter the Bill Number ");

String billnumber = sc.next();

int bill = Integer.parseInt(billnumber);

int x=0;

int temp=bill;

int count=0;

while(temp>0)

x = x+temp%10;

temp = temp/10;

count++;

if(count!=6 || x == 0)

System.out.println("Invalid bill number");

else if(x%2==1)

System.out.println("Enter the Purchased Amount: ");

int amount = sc.nextInt();

System.out.printf("Total bill amount is %.1f\n" , ((float)(amount)*90.0)/100);

else

System.out.println("Enter the Purchased Amount: ");

int amount = sc.nextInt();


System.out.printf("Total bill amount is %.1f\n" , ((float)(amount)*100.0)/100);

System.out.print("Congratulations!! You are selected for lucky draw");

Salary fixel software solution:-

public class Employee { 3

4 // Fill the code

5 private String employeeName;

6 private int employeeId;

7 private int incrementPercentage;

8 private double salary; 9

10 public void setEmployeeId(int employeeId){

11 this.employeeId=employeeId; 12 }

13 public int getEmployeeId(){

14 return employeeId; 15 }

16 public void setEmployeeName(String employeeName){

17 this.employeeName=employeeName; 18 }

19 public String getEmployeeName(){

20 return employeeName; 21 }

22 public void setSalary(double salary){

23 this.salary=salary; 24 }

25 public double getSalary(){

26 return salary;

27 }

28 public void setIncrementPercentage(int incrementPercentage){

29 this.incrementPercentage=incrementPercentage; 30 }

31 public int getIncrementPercentage(){


32 return incrementPercentage; 33 }

34 public Employee(int employeeId,String employeeName,double salary){

35 this.employeeId=employeeId;

36 this.employeeName=employeeName;

37 this.salary=salary; 38 }

39 public void findIncrementPercentage(int yearsOfExperience){

40 //Calculate the incremented salay of the employee

41 if(yearsOfExperience>=1&&yearsOfExperience<=5){

42 incrementPercentage=15; 43 }

44 else if(yearsOfExperience>=6&&yearsOfExperience<=10){

45 incrementPercentage=30; 46 }

47 else if(yearsOfExperience>=11&&yearsOfExperience<=15){

48 incrementPercentage=45; 49 }

50 }

51 public double calculateIncrementSalary(){

52 double incrementedSalary=salary+((salary*(double)incrementPercentage)/100);

53 return incrementedSalary; 54 }

MAIN .JAVA-

1 import java.util.*;

2 public class Main { 3

4 public static void main(String[] args) 5 {

6 Scanner read=new Scanner(System.in); 7

8 //Fill the code

9 try 10 {

11 System.out.println("Enter the Employee Id");

12 int id=Integer.parseInt(read.nextLine());

13 System.out.println("Enter the Employee Name");


14 String name=read.nextLine();

15 System.out.println("Enter the salary");

16 double salary=Double.parseDouble(read.nextLine());

17 System.out.println("Enter the Number of Years in Experience");

18 int exp_year=Integer.parseInt(read.nextLine());

19 Employee e=new Employee(id,name,salary);

20 e.findIncrementPercentage(exp_year); 21

22 double incrementedSalary=e.calculateIncrementSalary();

23 System.out.printf("Incremented Salary %.2f", incrementedSalary); 24 }

25 catch(Exception e) 26 {

27 System.out.println(e); 28 }

29 }

30

31 }

You might also like