/*
* -bai minh cho phep test du lieu nhap vao (so sinh vien) neu la ki tu hoac
* so sinh vien <=0 se yeu cau nhap lai
* - sau khi nhap va dua ra danh sach sinh vien chuong trinh yeu cau chon cong viecj muon thuc hien
* --> 1 sap xep ten sinh vien theo a,b,c
* --> tim kiem sinh vien theo 2 truong hop ( khong phan biet chu hoa va
* thuong):
* --> tim kiem chinh xac
* --> tim kiem theo tu khoa
*/
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>bai 25 - string (move your mouse to reveal the content)</noscript>
bai 25 - string (open)
bai 25 - string (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:
[color=#000000]
package baitapvenha[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]arrays[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/*** tạo 1 mảng các chuỗi là danh sách tên học sinh. nhập vào 1 chuỗi nào đó. sắp* xếp danh sách tên theo thứ tự bảng chữ cái a, b, c..... tìm kiếm tất cả các* tên học sinh giống tuyệt đối hoặc gần giống với từ khóa tìm kiếm đều được* hiện ra. ví dụ nhập từ khóa tìm kiếm: "hoang" thì sẽ hiện ra tất cả các tên* sau (nếu như chúng có trong danh sách): hoang thi yen, nguyen hoang hiep, vu* van hoang, hoang, hoang, hoang van tien, ... (kết quả tìm kiếm không phân* biệt chữ hoa và chữ thường!)*/[/color][color=#007700]public class [/color][color=#0000bb]buoi25_string [/color][color=#007700]{ static [/color][color=#0000bb]scanner sc [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]buoi25_string test [/color][color=#007700]= new [/color][color=#0000bb]buoi25_string[/color][color=#007700](); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"input the number n = "[/color][color=#007700]); try { [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]integer[/color][color=#007700].[/color][color=#0000bb]parseint[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
error: " [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700]); } if ([/color][color=#0000bb]n [/color][color=#007700]<= [/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
the number student have to > 0.
input again:
"[/color][color=#007700]); } while ([/color][color=#0000bb]n [/color][color=#007700]<= [/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]string dshocsinh[/color][color=#007700][] = new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]xuat[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700]); [/color][color=#0000bb]int choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); [/color][color=#0000bb]boolean b [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; while([/color][color=#0000bb]b[/color][color=#007700]){ switch ([/color][color=#0000bb]choose[/color][color=#007700]) { case [/color][color=#0000bb]1[/color][color=#007700]: [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]sapxep[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700]); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); break; case [/color][color=#0000bb]2[/color][color=#007700]: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]searchtuyetdoi[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700])); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); break; case [/color][color=#0000bb]3[/color][color=#007700]: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]search[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700])); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); break; case [/color][color=#0000bb]4[/color][color=#007700]: [/color][color=#0000bb]b [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"exit application! "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].exit([/color][color=#0000bb]0[/color][color=#007700]); default: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"the number \"" [/color][color=#007700]+ [/color][color=#0000bb]choose [/color][color=#007700]+[/color][color=#dd0000]"\" not valid in system! please try again:"[/color][color=#007700]); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); } } } public [/color][color=#0000bb]void nhap[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string a[/color][color=#007700][]) { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" student " [/color][color=#007700]+ [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } public [/color][color=#0000bb]void xuat[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string a[/color][color=#007700][]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"array student: "[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"-->" [/color][color=#007700]+ [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#dd0000]" : " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } public [/color][color=#0000bb]void sapxep[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]a[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
array student after sort: "[/color][color=#007700]); [/color][color=#0000bb]arrays[/color][color=#007700].[/color][color=#0000bb]sort[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700]); [/color][color=#0000bb]xuat[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]a[/color][color=#007700]); } public [/color][color=#0000bb]string searchtuyetdoi[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]a[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"input full name for search : "[/color][color=#007700]); [/color][color=#0000bb]string s [/color][color=#007700]= [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]string search [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]int dem [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700])) { [/color][color=#0000bb]search [/color][color=#007700]+= [/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]+[/color][color=#dd0000]"; "[/color][color=#007700]; [/color][color=#0000bb]dem[/color][color=#007700]++; } } if ([/color][color=#0000bb]dem [/color][color=#007700]!= [/color][color=#0000bb]0[/color][color=#007700]) return [/color][color=#dd0000]"==>have " [/color][color=#007700]+ [/color][color=#0000bb]dem [/color][color=#007700]+ [/color][color=#dd0000]" student with name " [/color][color=#007700]+ [/color][color=#0000bb]s [/color][color=#007700]+ [/color][color=#dd0000]":
" [/color][color=#007700]+ [/color][color=#0000bb]search[/color][color=#007700]; return [/color][color=#dd0000]"==>no student have name " [/color][color=#007700]+ [/color][color=#0000bb]s[/color][color=#007700]; } public [/color][color=#0000bb]string search[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string a[/color][color=#007700][]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"input the key for search: "[/color][color=#007700]); [/color][color=#0000bb]string s [/color][color=#007700]= ([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()).[/color][color=#0000bb]tolowercase[/color][color=#007700](); [/color][color=#0000bb]string search [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]int dem [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]tolowercase[/color][color=#007700]().[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700]) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]search [/color][color=#007700]+= [/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]+[/color][color=#dd0000]"; "[/color][color=#007700]; [/color][color=#0000bb]dem[/color][color=#007700]++; } } if ([/color][color=#0000bb]dem [/color][color=#007700]!= [/color][color=#0000bb]0[/color][color=#007700]) return [/color][color=#dd0000]"==>have " [/color][color=#007700]+ [/color][color=#0000bb]dem [/color][color=#007700]+ [/color][color=#dd0000]" student with key " [/color][color=#007700]+ [/color][color=#0000bb]s [/color][color=#007700]+ [/color][color=#dd0000]":
" [/color][color=#007700]+ [/color][color=#0000bb]search[/color][color=#007700]; return [/color][color=#dd0000]"==>no student have key " [/color][color=#007700]+ [/color][color=#0000bb]s[/color][color=#007700]; } public [/color][color=#0000bb]void [/color][color=#007700]list() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
==== list function ==== "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
1. sort"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
2. search by name excectly"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
3. search by key"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
4. exit"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
=> enter the choose: "[/color][color=#007700]); } public [/color][color=#0000bb]int choose[/color][color=#007700]() { [/color][color=#0000bb]int choose [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; list(); try { [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]integer[/color][color=#007700].[/color][color=#0000bb]parseint[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
error: " [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700]); } return [/color][color=#0000bb]choose[/color][color=#007700]; }}[/color]
</blockquote></div>
</div>
</div>
Khu chung cư cao cấp The Esme Dĩ An đầu tư bởi Công ty TNHH Đầu tư Xây dựng Thiên Hà – Băng Dương văn hoá đa dạng gần trung tâm đầu tư dài hạn. The Esme Dĩ An giagocchudautu.com văn hoá đa dạng...
Dự án chung cư The Esme Dĩ An sát trung tâm