Professional Documents
Culture Documents
Welcome Aliens
You reside in a desert place, One day a space shuttle lands in front of your eyes. An
Alien comes out of the space shuttle. The alien was so friendly and you just want to
welcome her to our planet. Write a program to welcome the alien to our planet EARTH.
Input Format:
Input consists of a single string (char array) that corresponds to the name of the alien.
Output Format:
Refer to the sample output for formatting specifications.
Note:
[All text in bold corresponds to input and the rest corresponds to output]
Write a program to generate the below pattern using nested "for" loops.
****
****
****
****
Sample Input 1:
Sample Output 1:
****
****
****
****
Sample Input 2:
5
Sample Output 2:
*****
*****
*****
*****
*****
Hint:
For the given problem, two for loops nested within each other is required .
The outer for loop is used to generate the number of rows required and the inner for
loop is used to generate the columns required. The pattern “*” must be displayed in the
inner for loop.
Customer Class
Assuming we have learned a good amount of Structured Programming (Variables,
Conditional Statements, Looping Constructs, Arrays) in Java, It's time to get Hands-on
with Object-Oriented programming thus harnessing the real power of Java.
You have been selected as a trainee in one of the well-known software majors. To
evaluate and expose you to real-world projects, the company has given you a
requirement document of the Phone Usage Tracking & Bill Generation application.
and a series of problems to program the application in a step-by-step manner. Go
ahead and solve the problems and learn Java along the way !!!
Note :
1.Strictly adhere to the object-oriented specifications given as mentioned in the problem
statement.
2.All text in bold corresponds to input and the rest corresponds to the output
String name
Integer age
String country
A 3-argument is provided. The order in which the parameters are set is the name,
age, and country.
The toString method to display the player details is Overriden in the format as specified
below.
Enter Name:
Henry
Enter Age:
29
Enter Country:
Australia
Name:Henry Age:29 Country:Australia
Player class
public class Player{
private String name;
private int age;
private String country;
Player(String name,int age,String country){
this.name=name;
this.age=age;
this.country=country;
}
display()
public String {
return "Name:"+this.name+" Age:"+this.age+" Country:"+this.country;
}
}
Main class
import java.io.*;
public class Main{
public static void main(String args[]) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Name:");
String name=br.readLine();
System.out.println("Enter Age:");
int age=Integer.parseInt(br.readLine());
System.out.println("Enter Country:");
String country=br.readLine();
Player p=new Player(name,age,country);
p.display()
System.out.println( );
}
}
YODA
Description: As a young jedi you must learn to converse with Yoda. You have found a
simple rule that helps change a “normal” sentence into “Yoda talk”. Take the first two
words in the sentence and place them at the end. A program that uses this rule to
change the normal sentences into “Yoda talk”, but unfortunately it is shuffled. Rearrange
the program in the correct order to get the expected output based on the input.
Input:
Input consists of a string that you must change into “Yoda talk”.
Note:
The maximum length of the input string is 100
Output:
Print the corresponding sentence in Yoda talk.
Sample Input:
I will go now to find the Wookiee
Sample Output:
go now to find the Wookiee I will
Abstract Practical Problem 1
Let us consider the concept of cricket for our first Abstract Practical Problem. Consider
the climax of the cricket match is going on (i.e second innings of the match) and we
need to calculate the required run rate for the team to win.
If we consider cricket match there are 3 international formats Test, ODI and T20 each
has 90overs per day, 50overs and 20overs respectively. Each over has 6 balls. In our
scenario, we will consider it as its 5th day of the Test match, so the team needs to
achieve the particular runs in 90overs.
Note: All text in bold corresponds to input and the rest corresponds to output.
Enter the Cricket Format
1.ODI
2.T20
3.Test
5
Invalid Format type
Exception All Around !
You start thinking -- Are exceptions around to catch only the alternate flows /
mistakes made by end-users. Exceptions mean exceptions !!! It can even be
used in business rules. A simple example would be to raise an exception
when a customer's unpaid credit card amount cross $2000 or is unpaid upto
45 days. Lets write a program that would check these details and raise a
custom exception stating "Further Transactions Not Possible until clearance of
bill.". Assume that the current date is '01/12/2015'.
3 ‘ } ‘ need at last