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...
You are the sales manager for US Consolidated Widgets, Inc. You get an email from a...
You are the sales manager for US Consolidated Widgets, Inc. You get an email from a Peter Sagan with an address in Slovakia asking for a quote to sell 100,000 widgets. A sale of that size would be the biggest transaction this year. Attached to the email is set of terms and conditions. You call the telephone number in the email and have a friendly discussion about the proposed transaction. Your company has never done international business. This situation raises...
Customers ID Name Street City Zip email 1 Emily 101 Anza St San Francisco 94118 2...
Customers ID Name Street City Zip email 1 Emily 101 Anza St San Francisco 94118 2 Amy 1 Houston Ave New York 12111 3 John 29 Sunset Blvd Los Angeles 45643 4 Pam 800 Market St San Francisco 94080 5 Sue 400 Muir Ave Redwood City 94598 6 Chris 987 A Ave New York 13111 7 Todd 788 Harrison St San Francisco 94117 Products ID Product_name Price Quantity 1 Metal pen 5.99 20 2 Surge protector 25.99 0 3 pencil...
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...
This program is in C++: Write a program to allow the user to: 1. Create two...
This program is in C++: Write a program to allow the user to: 1. Create two classes. Employee and Departments. The Department class will have: DepartmentID, Departmentname, DepartmentHeadName. The Employee class will have employeeID, emploeename, employeesalary, employeeage, employeeDepartmentID. Both of the above classes should have appropriate constructors, accessor methods. 2. Create two arrays . One for Employee with the size 5 and another one for Department with the size 3. Your program should display a menu for the user to...
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...
A university is a very busy place with a lot of students and also a lot...
A university is a very busy place with a lot of students and also a lot of employees to keep the system running perfectly. All people in the university have basic information like name, address, email and phone number. Employees at the university have extra information like employee-id and salary. There are also faculty and staff who are employees at the university. Each faculty has a designation and is assigned to a specific college and has number of courses taught....