CHAPTER 5 ASSIGNMENT - LEARN JAVA BY EXAMPLE
Trang 1 trong tổng số 1 trang
CHAPTER 5 ASSIGNMENT - LEARN JAVA BY EXAMPLE
Ques 1:
Build a class Student including 4 attributes: rollNo, name, age, score
class Student{
String rollNo;
String name;
int age;
int score;
}
a. Write input() method in class Student to enter students’ information.
b. Write display() method in class Student to show student’s info like the following:
(In format: RollNo Name Age Score)
Ex : C0710G01 Nguyen Viet Anh 20 90
c. In main method :
- Init an array of 5 students, enter 5 students from keyboard
- Display 5 students that you’ve just accepted.
- Display list of students in Alphabet order.
- Display list of students in Score descending order.
- Input a string; display all students whose names start with that given string.
String exercises
Ques 2:
Accept a CAPITAL string. Change every letters of each word to upper case, the others to lower case.
Ex: JAVA BY EXAMPLE Java By Example
Hint: Use String and StringBuilder
Ques 3:
Accept a string of numbers, separate by a semi coma(. Example: 15;30;4;-14
Print the total of odd numbers: 15
Print the total of even numbers: 20
Print the total of all numbers: 35
Hint: Use StringTokenizer
Ques 4:
Accept a string. Check if this string is symmetric or not. A symmetric string is a string has the same character at symmetric position. For example: madam, abccba…
Lời giải: [You must be registered and logged in to see this link.]
Build a class Student including 4 attributes: rollNo, name, age, score
class Student{
String rollNo;
String name;
int age;
int score;
}
a. Write input() method in class Student to enter students’ information.
b. Write display() method in class Student to show student’s info like the following:
(In format: RollNo Name Age Score)
Ex : C0710G01 Nguyen Viet Anh 20 90
c. In main method :
- Init an array of 5 students, enter 5 students from keyboard
- Display 5 students that you’ve just accepted.
- Display list of students in Alphabet order.
- Display list of students in Score descending order.
- Input a string; display all students whose names start with that given string.
String exercises
Ques 2:
Accept a CAPITAL string. Change every letters of each word to upper case, the others to lower case.
Ex: JAVA BY EXAMPLE Java By Example
Hint: Use String and StringBuilder
Ques 3:
Accept a string of numbers, separate by a semi coma(. Example: 15;30;4;-14
Print the total of odd numbers: 15
Print the total of even numbers: 20
Print the total of all numbers: 35
Hint: Use StringTokenizer
Ques 4:
Accept a string. Check if this string is symmetric or not. A symmetric string is a string has the same character at symmetric position. For example: madam, abccba…
Lời giải: [You must be registered and logged in to see this link.]
Similar topics
» CHAPTER 7 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 8 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 4 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 2&3 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 1 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 8 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 4 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 2&3 ASSIGNMENT - LEARN JAVA BY EXAMPLE
» CHAPTER 1 ASSIGNMENT - LEARN JAVA BY EXAMPLE
Trang 1 trong tổng số 1 trang
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|
Fri Jan 10, 2014 5:08 pm by trangan
» Luvina - Tuyển sinh Luvina Academy IX/2013
Tue Apr 09, 2013 2:21 pm by trangan
» LUVINA ACADEMY VIII TUYỂN SINH 2012
Mon Sep 17, 2012 3:16 pm by trangan
» Tuyển sinh khóa học lập trình viên_Luvina Academy VII (Hệ sơ cấp)
Tue Jul 10, 2012 7:01 pm by trangan
» Xin đề thi thực hành,lý thuyết và đáp án của môn Developing Web Services with Java
Tue Jan 10, 2012 12:58 pm by JinHoVN
» Nhờ các PRO vào làm giúp kái đề PCS này với
Fri Jan 06, 2012 1:06 pm by phongvan1991
» Đề cương ôn tập môn CF
Thu Nov 10, 2011 8:20 pm by thanhnc_b01392
» xin slide môn C
Sun Sep 04, 2011 5:33 pm by anhchang064
» Drugs In Japan
Tue Aug 02, 2011 5:58 am by Khách viếng thăm