II. Amaliy qism
Asosiy class
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Scanner;
public class Dokon {
public static void main(String[] args) throws IOException {
Scanner scfile = null;
try {
scfile = new Scanner(new File("dokonMalumot.txt"));
} catch (FileNotFoundException e) {
System.out.println("Fayldan o'qishda hatolik...");
}
String[] qatorlar = new String[8];
int i = 0,j=1;
while (true) {
assert scfile != null;
if (!scfile.hasNextLine()) break;
qatorlar[i] = scfile.nextLine();
i++;
}
Dictionary lugat = new Hashtable();
for (i=0,j=1;ilugat.put(qatorlar[i],Integer.parseInt(qatorlar[j]));
dokonklass mijozuchun = new dokonklass();
mijozuchun.mijozuchun(lugat);
}
}
Klass kodi:
import java.util.Dictionary;
import java.util.Scanner;
public class dokonklass {
public void mijozuchun(Dictionary lugat){
System.out.println("""
Tanlashingiz mumkin bo'lgan maxsulotlar
gilos
olma
anor
banan
""");
System.out.print("Sizga qaysi maxsulot narhi kerak ==> ");
Scanner sc = new Scanner(System.in);
String soradi=sc.nextLine();
System.out.println("Narhi "+lugat.get(soradi));
}
}
Natija:
III. Xulosa:
Loyiha ishini tayyorlash jarayonida men darsda o’rgangan bilimlarni mustahkamlab, loyiha tayyorlash tushunchalari haqida ko’nikmalarim oshdi. Foydalanuvchi talabiga mos dastur tuzish malakasi menda oshdi. Xar bir operator nima vazifa bajarishi, ulardan qaysi joylarda foydalanish ko’nikmalari yanada rivojlandi. Bilmagan bilimlarimni o’rgandim. Men ushbu loyiha ishini tayyorlaganimdan, o’qituvchimiz menga ushbu vazifani berganidan mamnunman.
IV.Foydalanilgan adabiyotlar:
w3school.com
Dasturchi telegram kanali
A.Qayumovning YouTube kanalidagi darslari va slaydlari
GeeksForGeeks.com
Dostları ilə paylaş: |