Question

• 2. Get all the information from the user using methods. • A. Name, email id,...

• 2. Get all the information from the user using methods.

• A. Name, email id, phone number, age. → Conditions are to be used here

Homework Answers

Answer #1

ANSWER:

Here I used Constructor and Conditions for user details. If conditions will true then that statement print perticular values.

public class Main
{
String Name;
String email;
int phno;
int age;
  
Main(String Name,String email,int phno,int age)
{
this.Name=Name;
this.email=email;
this.phno=phno;
this.age=age;
}
  
void getInfo()
{
if(Name.equals("Pulkit"))
{
System.out.println("Name:"+Name);

}
if(email.equals("hellopulkit"))
{
System.out.println("Email:"+email);

}
if(phno==1234567890)
{
System.out.println("phno:"+phno);

}
if(age==19)
{
System.out.println("Age:"+age);
  
}

}
  

public static void main(String[] args) {
  
   Main cl=new Main("Pulkit","hellopulkit",1234567890,19);
   cl.getInfo();

}
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
linux Regular expressions file name: lab3test.txt Employee ID Full Name Phone Age =========== ========= ===== ===...
linux Regular expressions file name: lab3test.txt Employee ID Full Name Phone Age =========== ========= ===== === 12564 Carol, Tara (222) 555-1231 44 45321 45612 Knotts, Don 78 29878 Evans, Bob (222) 341-4311 32122 Smith, 29 41221 Id, Bill 222-231-2322 33 41231 23121 Lemon, Jay 222-321-43 23341 Aaron, John 222-555-7321 34 12564 Carol, Tara (222) 555-1231 44 45321 Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Display all lines where the...
Create a class called Student. Include the following instance variables: name, address, phone, gpa Create all...
Create a class called Student. Include the following instance variables: name, address, phone, gpa Create all of the methods required for a standard user defined class: constructors, accessors, mutators, toString, equals Create the client for testing the Student class (5 points extra credit) Create another class called CourseSection (20 points extra credit) Include instance variables for: course name, days and times course meets (String), description of course, student a, student b, student c (all of type Student) Create all of...
***Programming language is Java. After looking at this scenario please look over the requirements at the...
***Programming language is Java. After looking at this scenario please look over the requirements at the bottom (in bold) THIS IS ALL THAT WAS PROVIDED. PLEASE SPECIFY ANY QUESTIONS IF THIS IS NOT CLEAR (don't just say more info, be specific)*** GMU in partnership with a local sports camp is offering a swimming camp for ages 10-18. GMU plans to make it a regular event, possibly once a quarter. You have been tasked to create an object-oriented solution to register,...
Consider a relation Employee which has information about employees in some company. Employee has attributes id,...
Consider a relation Employee which has information about employees in some company. Employee has attributes id, first, last, sin (social insurance number) where id and sin are the only CKs, and the FDs are: idfirst idlast sinfirst sinlast idsin sinid Employee Table ID First Last SIN 1 Jim Jones 111222333 2 Betty Smith 333333333 3 Jim Smith 456789012 4 Lee Mann 123456789 5 Samantha McDonald 987654321 Consider a relation Employee which has information about employees in some company. You need...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Part 1: Create the grid tic-tac-toe gameboard using buttons and iteration. Part 2: Human user gets...
Part 1: Create the grid tic-tac-toe gameboard using buttons and iteration. Part 2: Human user gets to select an open cell on the grid - place an X on that button selected Part 3: Check for a win using DOM iteration - new game option if row or column matching X pattern Part 4: Computer gets to select an open cell on the grid - place an O on that button selected Part 5: Check for a win using DOM...
Design a class with the following requirements: 1- give the class a name from your choice....
Design a class with the following requirements: 1- give the class a name from your choice. 2- write some code that creates three instance variables, choose a name and type for each one of them. (must have two private and one public variables) 3- Initialize the variables using two different constructors. 4- Use mutator and accessor methods (set and get) for the private data members. 5- Display the value of each member variable using a method. 6- In the main,...
50. What bacteria does MacConkey media select against? 51. Name 3 methods of isolating bacteria from...
50. What bacteria does MacConkey media select against? 51. Name 3 methods of isolating bacteria from a mixed culture. 52. What kind of mutation results from ultraviolet light exposure? 53. Name 2 methods bacteria can reverse the effect of UV light. 54. Which type of hemolysis produces a clear zone around the colony? 55. Is Salmonella a coliform? 56. Is Enterobacter a coliform? 57. What does the acronym IMVC stand for when testing the Enterobacteriaceae? 58. Name the one tube...
NOTE: you might be able to get all the necessary information from the Excel analysis output...
NOTE: you might be able to get all the necessary information from the Excel analysis output or the scatter plot. You don’t need to do computations by applying the numeric formula. A clothing department wants to find out if there is a relationship (and what kind of relationship) between the price of an item and the time that it takes to a customer to decide in buying that item. ITEM PRICE (X) DECISION TIME IN MINUTES (Y) $17 9 $63...
Language: C++ You're given a 1000-line text file, phoneno.txt, where each line consists of a 5-digit...
Language: C++ You're given a 1000-line text file, phoneno.txt, where each line consists of a 5-digit ID# and a phone# in the format of ###-###-####. The data were generated randomly so there might be duplicates in the IDs. You're asked to do the following by using standard library algorithms as much as possible: 1. read the file into a map which has an integer for key (ID#) and a string for value (phone#), this allows the duplicates to be removed....