O’zbekiston respublikasi axborot texnologiyalari va kommunikatsiyalarini rivojlantirish vazirligi muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti labaratoriya ishi mavzu



Download 24,72 Kb.
bet8/8
Sana12.01.2022
Hajmi24,72 Kb.
#353620
1   2   3   4   5   6   7   8
Bog'liq
TOPSHIRIQ 3

http://www.uza.uz - O`zbekiston milliy axborot agentligi
for (int i = 0; i < 3; i++)
res = res + alphabet[(int) (Math.random() * 10 % MAX)];

return res.toUpperCase();


}

private static double getPrice(String number, String letter) {


int countNumber = 0;
int countLetter = 0;

if (number.charAt(0) == number.charAt(1))


countNumber++;
if (number.charAt(0) == number.charAt(2))
countNumber++;
if (number.charAt(1) == number.charAt(2))
countNumber++;

if (letter.charAt(0) == letter.charAt(1))


countLetter++;
if (letter.charAt(0) == letter.charAt(2))
countLetter++;
if (letter.charAt(1) == letter.charAt(2))
countLetter++;

if (countNumber == 3 && countLetter == 3)


return 50_000_000;

if (countNumber == 3)


return 25_000_000;

if (countNumber > 0 && countLetter >0 || countLetter == 3 )


return 5_000_000;

return 1_000_000;


}

private static void putRegionNumber(BigDecimal initoalPrice, String numbers,String letters, AutoNumberService autoNumberService) {


ArrayList regionNumber = new ArrayList<>();
ArrayList region = new ArrayList<>();
regionNumber.add("01"); region.add("TOSHKENT_SHAHAR");
regionNumber.add("10"); region.add("TOSHKENT_VILOYATI");
regionNumber.add("20"); region.add("SIRDARYO");
regionNumber.add("25"); region.add("JIZZAX");
regionNumber.add("30"); region.add("SAMARQAND");
regionNumber.add("40"); region.add("FARG'ONA");
regionNumber.add("50"); region.add("NAMANGAN");
regionNumber.add("60"); region.add("ANDIJON");
regionNumber.add("70"); region.add("QASHQADARYO");
regionNumber.add("75"); region.add("SURXONDARYO");
regionNumber.add("80"); region.add("BUXORO");
regionNumber.add("85"); region.add("NAVOIY");
regionNumber.add("90"); region.add("XORAZM");
regionNumber.add("95"); region.add("QORAQALPOG'ISTON");
for (int i = 0; i < 14; i++) {
AutoNumber autoNumber = new AutoNumber();
autoNumber.setId();
autoNumber.setRegion(region.get(i));
autoNumber.setLetters(letters);
autoNumber.setRegionNumber(regionNumber.get(i));
autoNumber.setNumbers(numbers);
autoNumber.setInitialPrice(initoalPrice);
autoNumber.setStatus(Status.SOTUVDA);
autoNumber.setFullNumber(autoNumber.getRegionNumber()+" "+autoNumber.getNumbers()+" "+autoNumber.getLetters());
autoNumber.setCategories(Categories.YURIDIK_SHAXS);
autoNumberService.add(autoNumber);
changeToPhysical(autoNumber,autoNumberService);
}
}

private static void changeToPhysical(AutoNumber OldAutoNumber, AutoNumberService autoNumberService) {


AutoNumber autoNumber = new AutoNumber();
autoNumber.setId();
autoNumber.setNumbers(OldAutoNumber.getNumbers());
autoNumber.setLetters(OldAutoNumber.getLetters());
autoNumber.setRegionNumber(OldAutoNumber.getRegionNumber());
autoNumber.setRegion(OldAutoNumber.getRegion());
autoNumber.setInitialPrice(OldAutoNumber.getInitialPrice());
autoNumber.setStatus(OldAutoNumber.getStatus());
autoNumber.setCategories(Categories.JISMONIY_SHAXS);
autoNumber.setFullNumber(autoNumber.getRegionNumber()+" "+autoNumber.getLetters().substring(0,1)+" "+autoNumber.getNumbers()+" "+autoNumber.getLetters().substring(1));
autoNumberService.add(autoNumber);
}

public static void addUsers(UserService userService, CardService cardService){


User user = new User("DAVRON","+998944001404","1404","davrondavrik3@gmail.com",Categories.JISMONIY_SHAXS,"TOSHKENT VILOYATI");
user.setId();

Card card = new Card("8600 0423 8669 2833","04/23", CardFront.getBalance());


card.setId();
card.setUserId(user.getId());
cardService.add(card);

Card card1 = new Card("8600 3029 2775 4767","10/24", CardFront.getBalance());


card1.setId();
card1.setUserId(user.getId());
cardService.add(card1);
userService.add(user);

User user1 = new User("PDP","+998334001404","123456","pdp@gmail.com",Categories.YURIDIK_SHAXS,"TOSHKENT SHAXAR");


user1.setId();

Card card2 = new Card("8600 1058 1234 5678","05/22", CardFront.getBalance());


card2.setId();
card2.setUserId(user1.getId());
cardService.add(card2);

Card card3 = new Card("8600 1234 5432 9874","09/24", CardFront.getBalance());


card3.setId();
card3.setUserId(user1.getId());
cardService.add(card3);
userService.add(user1);
}
}

package service.authorization;

import model.authorization.User;
import service.base.BaseService;

import java.util.ArrayList;


import java.util.UUID;

public class UserService implements BaseService {


private ArrayList users = new ArrayList<>();

@Override


public boolean add(Object object) {
User newUser = (User) object;
boolean ans = false;
for (User user : users) {
if (user.getPhoneNumber().equals(newUser.getPhoneNumber())){
ans = true;
break;
}
}
if (!ans){
users.add(newUser);
}
return !ans;
}

@Override


public boolean add(Object object, Object object1) {
return false;
}

@Override


public boolean delete(Object object) {
return false;
}

@Override


public void list() {

}

public User getUser(String phoneNumber, String password){


User user1 = null;
for (User user:users) {
if (user.getPhoneNumber().equals(phoneNumber) && user.getPassword().equals(password)){
user1 = user;
break;
}
}
return user1;
}

public User getUser(UUID id){


for (User user:users) {
if (user.getId().equals(id)){
return user;
}
}
return null;
}
}



Download 24,72 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish