Assignment ON Modern Programming Tools & Techniques I
Assignment ON Modern Programming Tools & Techniques I
ON
Modern Programming
Tools & Techniques I
Student’s Signature :
___surendra__________
Evaluator’s comments:
________________________________________________________________
_____
Part A
Ans.
Abstraction :
Encapsulation: encapsulation makes the . the public adata can access by the
other class.data and fields private. We can not access this data only in public
class. The private data can access only with in the class. Encapsulation is also
called the data hiding.
• Class inheritance
• Interface inheritance
Ans: in the card game black jack sketch we need the following:
Ans. For sketching the system to controlling the soda dispensing machine we
need the many parts of object oriented programming. that are following:
• For getting the price of the soda we can use the public method of type
void.
[.............................]
Body[....................]
}
Part B
Ans.
• We can give the example of real world is that the bird will fly as their
parents. The bird is the class and the child bird is the subclass. this
subclass is inherithing the bird calss. All the attributes it can use of the
bird class.
• class Person {}
• class Bicycle {
• the another example of real world the bank account. The bank account
class can b inherited by the current account, saving account..
Q:5 How do methods System.out.print() and System.out.println() differ?
Define a java constant equal to 2.9979 X 108 that approximates the
speed of light in meters per second.
Ans. According to java the System.out.print() is used to print the string in one
line. In this method we can display the one line . but in the println the line
break automatically. In which line we used the prinln method the line
break automatically..
System.out.println("gaurav" );
System.out.println("kakkar " );
System.out.println("saurabh " );
System.out.println("tohana " );
Class speed
System.out.print (“days:”+d);
S= d*24*60*60;
d=slite*sec;
}
}
Q:6 Write a code segment that defines a Scanner variable stdin that is
associated with System.in. The code segment should than define to int
variables a and b, such that they are initialized with the next two input
values from the standard input stream.
import java.util.*;
public class test
{
public static void main(String[] args)
{
Scanner stdin = new Scanner(System.in);
System.out.print(“Number:”);
double n = stdin.nextDouble();
System.out.println(n + “ * “ + n + “ = “ + n * n);
}
}
Ans..
• Variable: stdin, n
• Class: test