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
HR needs some information on the new interns put into a database. Given an id, email,...
HR needs some information on the new interns put into a database. Given an id, email, first name, and gender. Create an object for each person in the company list: // 1, [email protected], Mitzi, F // 2, [email protected], Kennan, M // 3, [email protected], Keven, M // 4, [email protected], Gannie, M // 5, [email protected], Antonietta, F // Example format of an intern object: 1, [email protected], Example, F const example = { id: 0, name: "Example", email: "[email protected]", gender: "F" }; //...
Write C++ program to create a student record include a student ID, first name, nickname, course,...
Write C++ program to create a student record include a student ID, first name, nickname, course, subject, and subject marks. Task: Create a function to insert a number of students in the record. Create a function to print all student information by a table. Create a function to print all student information that they're in a specific course chosen by user input. Create a function to search for a student by student ID and print student information. Create a function...
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 complete C++ program that will read from a file, "studentInfo.txt", the user ID for...
create a complete C++ program that will read from a file, "studentInfo.txt", the user ID for a student (first letter of their first name connected to their last name i.e. jSmith). Next it will need to read three integer values that will represent the 3 e xam scores the student got for the semester. Once the values are read and stored in descriptive variables it will then need to calculate a weighted course average for that student. Below is an...
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...
2). Question with methods use scanner (Using Java): You are going to invest the amount, then...
2). Question with methods use scanner (Using Java): You are going to invest the amount, then you going to compute that amount with annual interest rate. 1) Prompt the user to enter student id, student name, student major 2) Declare variables consistent with names that you are prompting and relate them to the scanner 3) Declare the amount invested in college, prompt the user to ask for amount and declare variable and scanner to input 4) Declare the annual interest...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID numbers currently in use Read in a new ID number If the ID number read in is already in use Report this fact End this script Else (this is a new ID number) Read in: Years with the company Salary Vacation days Sick days Add this new employee to the database (by appending a new row to the end of the EmployeeData matrix) Note...
Using the Entities and Attributes you created for your business from the week 1 discussions. Show...
Using the Entities and Attributes you created for your business from the week 1 discussions. Show the tables and relationships resulting from your model in the form of an E/R diagram. You can use PPT, VISIO or any other graphical modeling tool to create your ER diagram. Some of the entities and attributes that I believe my company should have would be: Employees: First Name, Last Name, Employee Address, Employee Phone Number, Employee ID Number, Date of Birth, Social Security...
USING JAVA: I was asked to write a function that obtains a name from the user...
USING JAVA: I was asked to write a function that obtains a name from the user and returns it in reverse order (So if the user inputs "MIKE" the function returns "EKIM"). You can't use string variables it can only be done using a Char Array. Additionally, you can use a temporary Char Array but you are supposed to return the reverse order in the same char array that the user input, this is for hypothetical cost purposes -we are...