Code Monkey home page Code Monkey logo

lotto-kingdom-jpa-backend's Introduction

로또의민족 소마국

소마국에서는 매 100일마다 로또 당첨 번호를 공개하는 행사가 있다.

국민들은 로또 번호 공개 이전까지 로또를 구매하고, 당첨 번호 공개 이후에 당첨금을 회수할 수 있다.

소마국의 로또 시스템을 전산화하는 프로그램을 만들어 소마국을 도와주자.

API 목록

1. buy (int userNum, int money, long date)

사용자가 date일에 로또를 구입한다.

구입 금액은 1,000원 단위로 입력 받으며 1,000원으로 나누어 떨어지지 않는 경우 예외 처리한다.

로또의 번호는 랜덤으로 생성된다.

로또의 id와 로또 번호를 출력한다.

출력 예시

4개를 구매했습니다.
121 : [8, 21, 23, 41, 42, 43] 
122 : [3, 5, 11, 16, 32, 38] 
123 : [7, 11, 16, 35, 36, 44] 
124 : [1, 8, 11, 31, 41, 42] 

2. getLottoInfo (int lottoId, long date)

lottoId에 해당하는 로또의 당첨 여부를 출력한다

아직 당첨 번호가 공개되지 않은 로또일 경우 미공개로 출력한다.

출력 예시

// 정답이 공개된 로또의 출력결과
11번 로또의 당첨 정보 : 5등

// 정답이 공개되지 않은 로또의 출력결과
11번 로또의 당첨 정보 : 미공개 (200일 에 공개)

3. getUserInfo (int userNum, long date)

사용자 userNum의 당첨 이력을 전부 조회한다.

아직 당첨 번호가 공개되지 않은 로또일 경우 미공개로 분류한다.

출력 예시

당첨 통계
---
3개 일치 (5,000원) - 9개
4개 일치 (50,000원) - 1개
5개 일치 (1,500,000원) - 0개
5개 일치, 보너스 볼 일치 (30,000,000원) - 0개
6개 일치 (2,000,000,000원) - 0개
미공개 - 2개
---
총 구매금액 : xxx원
총 수입금액 : xxx원
총 수익률은 62.5%입니다.

기능 요구사항

요구사항

  • 한 주 내의 모든 로또는 중복되지 않아야 한다.
  • 정답로또, 보너스번호는 매 1000초마다 재발급된다.
    • 0~999초에 구매한 로또 : 1000초 이후에 결과확인 가능

보장사항

  • 1 ≤ userNum ≤ 1000
  • 1 ≤ date ≤ 10000
  • date는 항상 증가하며, 중복되지 않는다.
  • lottoId는 1에서부터 순차적으로 증가한다.

미션 수행 예시

Applications.java 예시

public static void main() {

buy (int userNum, int money, long date)
getLottoInfo (int lottoId, long date)
getUserInfo (int userNum, long date)
	buy(1, 2000, 1); // 1date : 유저1이 2장 구매
	buy(8, 3000, 2); // 2date : 유저8이 3장 구매
	buy(21, 3000, 3); // 3date : 유저21이 3장 구매
	
	buy(1, 1000, 11); // 11date : 유저1이 1장 구매

	// ...
	getLottoInfo(2, 15) // 1번 로또의 당첨 정보 : 미공개(100일에 공개)

	// ... 
	getLottoInfo(2, 101) // 1번 로또의 당첨 정보 : 3등

	// ... 
	getUserInfo(1, 102)
	
}

출력 예시

user 1 의 구매 내역
1 : [8, 21, 23, 41, 42, 43] 
2 : [1, ... ] 

user 8 의 구매 내역
3 : [...] 
4 : [1, ... ] 
5 : [1, ... ] 

user 21 의 구매 내역
6 : [...] 
7 : [...] 
8 : [...] 

// ...

// getLottoInfo(2, 15)
1번 로또의 당첨 정보 : 미공개(100일에 공개)
// getLottoInfo(2, 101)
1번 로또의 당첨 정보 : 3// getUserInfo(1, 102)
1번 유저의 당첨 통계
---
3개 일치 (5,000원) - 94개 일치 (50,000원) - 15개 일치 (1,500,000원) - 05개 일치, 보너스 볼 일치 (30,000,000원) - 06개 일치 (2,000,000,000원) - 0개
미공개 - 2개
---
총 구매금액 : xxx원
총 수입금액 : xxx원
총 수익률은 62.5%입니다.

lotto-kingdom-jpa-backend's People

Contributors

ray-yhc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.