Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous closing price: 34.5 Enter the current price: 34.35 Stock name: Oracle Corporation Stock symbol: ORCL Stock ID: 59 Price-change percentage: - 0.434782608695648 Challenge Question - Using GregorianCalendar and Date classes: (Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in the java.util package, which you can use to obtain the current date with specific details like current year, current month, current day of a date and so on. Write a program to perform these tasks:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Enter the name of Stock: Oracle Corporation
Enter the symbol of Stock: URCL
Enter the previous closing price: 34.5
Enter the current price: 34.35
Stock name: Oracle Corporation
Stock symbol: ORCL
Stock ID: 59
Price-change percentage: - 0.434782608695648
Challenge Question - Using GregorianCalendar and Date classes:
(Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in
the java.util package, which you can use to obtain the current date with specific details like
current year, current month, current day of a date and so on.
Write a program to perform these tasks:
1. Display the current year, month, and day.
2. Display the current date by using the to String() method from the Date class.
3. Display the current time-which is used to display the number of milliseconds- by
using getTime() method from the Date class. We will use it in the step 17.
4. - Display the current year by using get(GregorianCalendar.YEAR) method from to
GregorianCale class.
5- Display the current year by using get(GregorianCalendar MONTH) method from the
GregorianCalendar class. Note: this method -which is used for month- starts from 0 to 11
(0 indicates January). You must take care about this issue for adding 1 in order to display
1 for January.
6- Display the current Day by using get(GregorianCalendar.DAY_OF MONTH) method
from the GregorianCalendar clasclas
7-Display the current Week by using get(Gregorian Calendar.DAY_OF_WEEK) method
From the GregorianCalendar class.
8- Display the current DAY OF WEEK IN MONTH by using Get(GregorianCalendar.DAY OF
WEEK_IN_MONTH) method from the GregorianCalendar class.
9- Display the current Day of Year by using get(GregorianCalendar.DAY_OF YEAR).
10-Display the current Hour by using get(GregorianCalendar.HOUR)
11-Display the current Hour of day by using get(GregorianCalendar.HOUR_OF DAY).
12-Display the current MINUTE by using get(Gregorian Calendar.MINUTE).
13-Display the current Second by using get(GregorianCalendar.SECOND).
14-Display the current Millisecond by using get(Gregorian Calendar MILLISECOND) .
15- Display the current Week of month by using get(GregorianCalendar.WEEK_OF MONTH).
16-Display the current Week of year by using get(Gregorian Calendar.WEEK_OF YEAR).
17-Finally, use setTime() method which sets your current time (Step 3) and display your date
and time using the toString() method after adding these milliseconds (In for loop): 1, 10, 100,
1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, and
100000000000.
Transcribed Image Text:Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous closing price: 34.5 Enter the current price: 34.35 Stock name: Oracle Corporation Stock symbol: ORCL Stock ID: 59 Price-change percentage: - 0.434782608695648 Challenge Question - Using GregorianCalendar and Date classes: (Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in the java.util package, which you can use to obtain the current date with specific details like current year, current month, current day of a date and so on. Write a program to perform these tasks: 1. Display the current year, month, and day. 2. Display the current date by using the to String() method from the Date class. 3. Display the current time-which is used to display the number of milliseconds- by using getTime() method from the Date class. We will use it in the step 17. 4. - Display the current year by using get(GregorianCalendar.YEAR) method from to GregorianCale class. 5- Display the current year by using get(GregorianCalendar MONTH) method from the GregorianCalendar class. Note: this method -which is used for month- starts from 0 to 11 (0 indicates January). You must take care about this issue for adding 1 in order to display 1 for January. 6- Display the current Day by using get(GregorianCalendar.DAY_OF MONTH) method from the GregorianCalendar clasclas 7-Display the current Week by using get(Gregorian Calendar.DAY_OF_WEEK) method From the GregorianCalendar class. 8- Display the current DAY OF WEEK IN MONTH by using Get(GregorianCalendar.DAY OF WEEK_IN_MONTH) method from the GregorianCalendar class. 9- Display the current Day of Year by using get(GregorianCalendar.DAY_OF YEAR). 10-Display the current Hour by using get(GregorianCalendar.HOUR) 11-Display the current Hour of day by using get(GregorianCalendar.HOUR_OF DAY). 12-Display the current MINUTE by using get(Gregorian Calendar.MINUTE). 13-Display the current Second by using get(GregorianCalendar.SECOND). 14-Display the current Millisecond by using get(Gregorian Calendar MILLISECOND) . 15- Display the current Week of month by using get(GregorianCalendar.WEEK_OF MONTH). 16-Display the current Week of year by using get(Gregorian Calendar.WEEK_OF YEAR). 17-Finally, use setTime() method which sets your current time (Step 3) and display your date and time using the toString() method after adding these milliseconds (In for loop): 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, and 100000000000.
Expert Solution
steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY