Sie sind auf Seite 1von 19

1)A bank customer needs to perform 1. Withdraw   2.

Deposit transactions on his


bank account.

While performing the above transactions, customer should fulfil the


banking business domain requirements.

Requirements :
     * The customer has to maintain minimum balance of INR 10,000.
     * Zero and Negative values for amount for both withdraw and
        deposit transactions should not accept.

Input -      
                      Current Balance
                      "WD" for withdraw and "DP" for deposit transactions.
                      "Amount"  

Output - 
                      "Successful", if all the requirements are met
                      "Amount should be more than 0", if amount is less than equal to zero
                     "Insufficient Balance", if the balance is less than INR 10,000 after
withdrawal
-----------
Ex : 1
    
Input :

     INR 12000
     WD
     INR   2000

Output :   

      "Successful"

-----------
Ex : 2    

Input :
      INR 20000
      DP
      INR        0 

Output :   
   
      "Amount should be more than 0"

------------
Ex : 3

Input :

        INR 35000
        WD
        INR 35001

Output :   

       "Insufficient Balance"

Pseudo code:-

Begin
Create class
Create main
Enter current balance
Enter transaction type
if(balance<=0) insufficient balance
if(amount<=0) transaction should not take place
if(amount>balance) insufficient balance
print the wd and dp results
print result
stop

Program:-
//create package
package day24;
//create scanner class for taking the input from the keyboard
import java.util.Scanner;
//create class
public class Bankaccoun {
//create mainmethod
public static void main(String[] args){
System.out.println("Enter Current Balance:");
//to take input from key board use scanner
Scanner sc=new Scanner(System.in);
int balance=sc.nextInt();
System.out.println(balance);
System.out.println("Enter Transaction Type: WithDraw (WD)or
Deposit(DP)");
String w=sc.next();
System.out.println(w);
System.out.println("Enter amount:");
int amount=sc.nextInt();
System.out.println(amount);
//if-else-if for logic of the program
if(balance<=0){
System.out.println("Insufficient Balance");
}
else{
if(amount<=0){
System.out.println(" transactions should not accept
amount should more than zero");
}
else if(amount>balance){
System.out.println("Insufficient Balance");
}
else{
if(w.equals("WD")){
System.out.println("WithDrawl Successful");
}
else if(w.equals("DP")){
System.out.println("Deposit Successful");
}

}//end else

}//end else

}//end main
}//end class

OUTPUT:-
-------------------------------------------------------------------------------------------------------------
------------------------------------------------

Scenario -2 [ Retail Domain ]

A retail chain provides certain benefits to delight the customers.


Requirements :
      
      * No offers for the bill amount not exceeding $200
      * 10% on bill amount when the amount is in the exceeding $200
         This is not applicable for the packaged food items
      * Free delivery for the bill amount exceding $500 along with above two
benefits
      * Additional 15% for the customers whose birth day falls on purchase date

Inputs should be in the order of --> Bill amount, Packaged Food Items [Y/N], Birth
date [Y/N]
          
Ex : 1

  Input :
 
       $200
    N
    N
 
 Output :
 
      "No Offers" 
-------------
Ex : 2
      
    Input :

            $245
      Y
            N       

      Output :   
    
        "You are offered with 10% discount"

------------
Ex : 3
      Input :
            $200
      N
      Y

Output :   

            "Happy Birthday! You are offered with additional 15% discount"

------------
Ex : 4 Input :
            
            $568
      Y
      N

Output :   

            "You are offered with free delivery"

Pseudo code:-

Begin

Create class

Enter bill amount

Enter buying items

Enter today date is your birthday or not

Print discount and offers based on given conditions

Print result

stop

Program:-
//cretae package
package day24;
//create scanner class for taking the input from the keyboard
import java.util.Scanner;
//create class
public class Custom{
//main method
public static void main(String[] args){
System.out.println("Enter Bill amount:");
//Take input from keyboard we use scanner class
Scanner sc=new Scanner(System.in);
int B=sc.nextInt();
System.out.println("$"+B);
System.out.println("Enter your buying items are Packaged food items or
not:(Y/N)");

String P=sc.next();
System.out.println(P);
System.out.println("Enter today date is your Birth date or not:
(Y/N)");
String BD=sc.next();

System.out.println(BD);
if(B<200){
System.out.println("No offers");
}

else if(B>=200 && B<=500){


if(P.equals("N")){
if(BD.equals("N")){
System.out.println("No Offers");
}
else if(BD.equals("Y")){
System.out.println("Happy Birthday you got another 15%
discount");
}
}
else if(P.equals("Y")){
if(BD.equals("N")){
System.out.println("You offered wth 10% discount");
}
else if(BD.equals("Y")){
System.out.println("Happy Birthday you got another 15%
discount");
}
}
}
else if(B>500){
if(P.equals("Y")){
if(BD.equals("N")){
System.out.println("You are offered with free delivery");
}
else if(BD.equals("Y")){
System.out.println("Happy Birthday you got another 15%
discount");
}
}
}
}//end main
}//end class

OUTPUT:-
3.Telstar Infocom provides Cable TV services to Corporates and Retail
customers. Their Corporate customers are companies involved in trading,
hospitality, health care, insurance, courier, transportation companies etc. They
supply various channels like news, sports, finance and business etc., to cater to
the needs of different customers. Their Retail customers are local Cable TV
operators who get the signals from Telstar Infocom and further distribute the
signals to individual customers in their localities. As part of their goal to
provide better services to their customers and to function more efficiently they
look at computerizing their customer-related operations. The inputs to be given
to this system for registering customers are as follows: -

Name, Package(Gold, Normal, Silver, Platinum), SetBoxRequired

The calculation of charges are as follows: -

If Package is P, package price is Rs. 9000 per year for any 200 HD channels of
customer choice.

If Package is N, package prices is Rs. 4000 per year for any 50 Non-HD channels of
customer choice. No HD channels in this plan.

If Package is S, package price is Rs. 6000 per year for any 70 HD channels and any
130 Non-HD channels of customer choice.

If Package is G, package price is Rs. 7500 per year for any 150 HD channels and
any 50 Non-HD channels of customer choice.

If SetTopBoxRequired is Yes, add Rs. 1500 for bill as STB Price. Else STB price
should be show as 0.

Sample Input :

Name : Mahesh Kumar

Package : Platinum

SetTopBoxRequired : Yes
The program should display the following(Sample output) : -

Package Price Rs. 9000

STB Price Rs. Rs. 1500

Gross Price(Package Price+STB Price) Rs. 10500

GST (13% of Gross) Rs. 1365

Net Amount Rs. 11865

GST is assumed as 13% of Gross Amount.

Repeatedly take inputs for multiple customers and calcuate the total amount for
each customer, until the user types Yes. If user types No, the program should end.

Program:-
//create package
package day24;
//create scanner class for taking the input from the keyboard
import java.util.Scanner;
//create class
public class Connec{
//main method
public static void main(String[] args){
System.out.println("Enter Name:");
//Take input from keyboard we use scanner class
Scanner sc=new Scanner(System.in);
String name=sc.next();
System.out.println(name);
System.out.println("Enter Package:(available package name are Gold,
Normal, Silver, Platinum)");
String p=sc.next();
System.out.println(p);
System.out.println("Enter Setup box required or not(YES/NO:)");
String STB_Box=sc.next();
System.out.println(STB_Box);
float GST_PER=13;
float STB_price=0;
float P_amount=0;
float Gross_Price=0;
float Net_amount=0;
if(p.toUpperCase().equals("PLATINUM")){
P_amount=9000;
}
else if(p.toUpperCase().equals("NORMAL")){
P_amount=4000;
}
else if(p.toUpperCase().equals("SILVER")){
P_amount=6000;
}
else if(p.toUpperCase().equals("GOLD")){
P_amount=7500;
}
System.out.println(P_amount);
if(STB_Box.toUpperCase().equals("YES")){
STB_price=1500;
}
else if(STB_Box.toUpperCase().equals("NO")){
STB_price=0;
}

Gross_Price=P_amount+STB_price;
System.out.println("Gross Price (PackagePrice+STB Price)
Rs."+Gross_Price);
System.out.println("GST(13% of Gross) Rs."+((Gross_Price)*13)/
(float)100);
Net_amount=Gross_Price+((Gross_Price)*13)/(float)100;
System.out.println("Net Amount = Rs."+Net_amount);

}//end main method

}//end class

OUTPUT:-

---------
4. A Transport company Exilant Transports is in the cargo handling business.
They take care of transporting the cargo from their client premises to the
harbors/airports and vise-versa. . The cargo transported is insured by Exilant
Transports and they get the coverage from various insurance companies. They
also take care of packaging the cargo. They charge their customers depending
upon the measurement used in weighing the cargo. For ex: petrol, milk etc., is
measure in litres/gallons. Food grains, packed foods, Furnitures, fixtures,
electronic goods, vehicles etc., are measured in kgs/quintals/tonnes. As part of
their goal to provide better and efficient service to their customers, they intend
to computerize their operations.

Base Charges are as follows : -

For liquid goods Rs. 200 / gallon

For solid goods Rs. 150 / ton.

4 litres of liquid 1 Gallon.


1000 kg is 1 Ton

Insurance premium are calculated as follows : -

For liquid goods Rs. 20 per gallon.

For solid goods Rs. 2500 per tonne

Toll Tax is calculated as Rs. 120 for every 80 kms of travel. Minimum distance of
transport is 150 kms and not less than that.

GST is calculated as 13% of Gross Amount.

The system should take GoodsType(liquid/solid), Volume and Distance as inputs


and calculate the total charges as per the conditions mentioned above. Sample
input: -

Goods Type : liquid, Volume : 1000 ltrs, Distance : 500 kms

Sample output :

Goods Type : liquid

Base Charges : 50000

Insurance Premium : 5000

TollTax : 750
Gross : 55750(BaseCharges+InsPremium+TollTax)

GST : 7247

Net Amount : 62997

Repeat these steps for N number of goods booked until the user enters YES or
No. If Yes program should terminate else it should take inputs for the next
goods and calculate charges.

Program:-
//create package
package day24;
//create scanner class for taking the input from the keyboard
import java.util.Scanner;
//create class
public class Transport{
//main method
public static void main(String args[]){
System.out.println("Enter goods Type(for liquid in litres and for
solid in tons):");
//Take input from keyboard we use scanner class
Scanner sc=new Scanner(System.in);
String ftype=sc.next();
System.out.println(ftype);
System.out.println("enter volume of the goods:");
float volume=sc.nextFloat();
System.out.println(volume);
System.out.println("enter distance:");
float d=sc.nextFloat();
System.out.println(d+"kms");
float content=0;
float Acharges=0;
float insurance=0;
float tolltax=0;
float GSTamount=0;
float Gross=0;
System.out.println(volume/4);

if(ftype.toUpperCase().equals("LIQUID")){

Acharges=(volume*200)/4;
insurance=(volume*20)/4;

}
else if(ftype.toUpperCase().equals("SOLID")){
content=volume/1000;
Acharges=content*150;
insurance=content*2500;
}
System.out.println("Base Charges:"+Acharges);
System.out.println("Insurance Premium:"+insurance);

tolltax=(d*120)/80;
System.out.println("TollTax:"+tolltax);
Gross=Acharges+insurance+tolltax;
System.out.println("Gross:"+Gross);

GSTamount=((Gross)*13)/100;
System.out.println("GST:"+GSTamount);
System.out.println("NET_Amount:"+(Gross+GSTamount));

}//end main

}//end class

OUTPUT:-

5. Health care scenario:


Inputs-MALE/FEMALE INPUT3-CITY/VILLAGE INPUT4-25 to 35
If(input1 is 1 ,input2 is ‘M’,input3 is ‘c’,input4 is age)
Then money allotted should not be more than 1,00,000.
Alpha Healthcare Center wants to develop a software application. Using
their application, they want to give reimbursement of medical expenses
of their registered users. The members may be registered from City or
Village and the gender of the members can be Male or Female and
different age groups. Based on these parameters the maximum
reimbursement amount will be computed.
The scenarios are as below :
Male registered from city is 1,00,000.00 and female is 20% less than
male.
Male registered from village is 75,000.00 and female is 15% more than
male.
The above mentioned rates are applicable for the age of the member is
upto 20 years. For every 10 years 10% of amount is to be increased in
all slabs mentioned above.

Program:-
//create package
package day24;
//create scanner class for taking the input from the keyboard
import java.util.Scanner;
//cretae class
public class AlphaHealthCare{
//main method
public static void main(String args[]){
System.out.println("Enter Gender:\n");
//Take input from keyboard we use scanner class
Scanner sc=new Scanner(System.in);
String Gender=sc.nextLine();
System.out.println(Gender);
System.out.println("Enter location:\n");
String Location=sc.nextLine();
System.out.println(Location);
System.out.println("enter age:(enter age (for every 10 years reimbursement
will be increased so enter age as 30, 40,... after 20 years)");
int Age=sc.nextInt();
System.out.println(Age);
double Fixed_Amount=100000;
double r=0;
double s=0;

if(Age<=20){
if(Gender.equals("M")){
if(Location.equals("city")){
r=Fixed_Amount;
}
else if(Location.equals("village")){
r=Fixed_Amount-25000;
}
System.out.println("reimbursement is: "+r);
}
if(Gender.equals("F")){
if(Location.equals("city")){
r=Fixed_Amount-(Fixed_Amount*20)/100;

}
else if(Location.equals("village")){
r=(Fixed_Amount-25000)+((Fixed_Amount-25000)*15)/100;
}
System.out.println("reimbursement is: "+r);
}

}
else if((Age-20)%10==0){
if(Gender.equals("M")){
if(Location.equals("city")){
r=Fixed_Amount+(Fixed_Amount*(Age-20)/10)*0.1;
}
else if(Location.equals("village")){
r=(Fixed_Amount-25000)+((Fixed_Amount-25000)*(Age-20)/10)*0.1;
}
System.out.println("reimbursement is: "+r);
}
if(Gender.equals("F")){
if(Location.equals("city")){
r=(Fixed_Amount-(Fixed_Amount*20)/100);
s=r+r*((Age-20)/10)*0.1;
}
else if(Location.equals("village")){
r=(Fixed_Amount-25000)+((Fixed_Amount-25000)*15)/100;
s=r+r*((Age-20)/10)*0.1;
}
System.out.println("reimbursement is: "+s);
}
}
}//end main
}//end class

OUTPUT:-

Das könnte Ihnen auch gefallen