forked from cs-dept-ibbul/java2019
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab6TestAuthor.java
More file actions
32 lines (31 loc) · 1.02 KB
/
Copy pathlab6TestAuthor.java
File metadata and controls
32 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Write a description of class TestArthur here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.Scanner;
public class TestAuthor
{
public static void main(String[ ] args) {
Scanner input = new Scanner(System. in);
String name,email;
char gender;
System.out.print("Enter Author Name: ");
name = input.nextLine();
System.out.print("Enter gender e.g M or F: ");
gender = input.next().charAt(0);
input.nextLine();
System.out.print("Enter email: ");
email = input.nextLine();
//any of the following constructors be used to create the object
Author author = new Author(name, email,gender);
System.out.println(author);
//enter new email
System.out.print("\nEnter new email: ");
email = input.nextLine();
author.setEmail(email);
//print new email
System.out.println(author);
}
}