This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pager { | |
long totalCount; | |
long totalPages; | |
Pager(long totalCount) { | |
this.totalCount = totalCount; | |
this.totalPages = totalCount % 10 == 0 ? totalCount / 10 : totalCount / 10 + 1; | |
} | |
public String html(long pageIndex) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class Mission2 { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.print("내 좌표값 x를 입력하세요(숫자만 입력): "); | |
int myX = sc.nextInt(); | |
System.out.print("내 좌표값 y를 입력하세요(숫자만 입력): "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class property { | |
public static final String ln = "\n"; | |
public static final String openTableRow = "<tr>"; | |
public static final String closeTableRow = "</tr>"; | |
public static final String openTableCol = "<td>"; | |
public static final String closeTableCol = "</td>"; | |
public static final String openTableHead = "<th>"; | |
public static final String closeTableHead = "</th>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.util.Arrays; | |
public class TaxProgram { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("[과세금액 계산 프로그램]"); | |
System.out.print("귀하의 연소득을 입력해 주세요: "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Scanner 함수사용, 조건문반복문, 배열사용, | |
입력: 구매수량 > 출력 N개만큼 출력 > 당첨번호생성 > 구매한 로또 당첨확인 | |
숫자 중복안됨, 작은수부터 정렬해서 나열 | |
Collections.shuffle 함수 사용하지 않기. | |
*/ | |
import java.util.Arrays; | |
import java.util.Random; | |
import java.util.Scanner; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- 총 투표를 진행할 투표수를 입력 받음 | |
- 선거를 진행할 후보자 수를 입력받고 이에 대한 이름을 입력 받음 | |
- 각 입력받은 후보자는 순서대로 기호1, 기호2, 기호3 형식으로 기호번호 부여함 | |
- 각 투표수의 결과는 선거를 진행할 후보자를 통일한 비율로 랜덤생성 | |
- 임의번호는 Random함수의 nextInt()함수를 통해서 생성 | |
- 1표에 대한 투표한 결과에 대해서 투표자와 이에대한 결과를 출력 | |
투표수 : 1 ~ 10000(만) 사이의 값을 입력하며, 입력예외는 없음 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDate; | |
import java.util.Scanner; | |
public class CalCalender { | |
public static void main(String[] args) { | |
System.out.println("[달력 출력 프로그램]"); | |
System.out.print("달력의 년도를 입력해 주세요.(yyyy): "); | |
Scanner findCal = new Scanner(System.in); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Scanner 사용하기, 조건문사용하기(횟수무제한 while), 랜덤클래스 주민번호생성식 | |
2020년생부터 입력가능 이전 출생자는 새로운 방식으로 출력불가(문제조건 2020년이후입력) | |
2000년생 이후는 다 앞자리 3,4 사용하기 | |
출생년도, 출생원, 출생일, 성별, 나머지 임의번호 | |
임의번호 Random함수의 nextInt()사용 | |
임의번호 범위, 개수도 6개 다 출력되어야 (1 ~ 999999) | |
*/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Scanner 사용, 다중조건문 사용 | |
나이와 기타 우대사항에 따라 입장료 다름 | |
입력순서 > 나이, 입장시간, 국가유공자, 복지카드 | |
<놀이공원 할인> | |
* 할인은 중복안됨 중복시 더 큰할인금액이 선택됨 | |
- 3세미만 무료입장 (100%) | |
- 3세이상 13세미만 , 17시 이후 입장 특별할인 (60%) | |
- 복지카드, 국가유공자 일반할인 (20%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Scanner를 사용, 조건문사용 | |
<캐시백조건> | |
- 결제금액의 10% | |
- 캐시백 포인트단위 100원 (또한 최소100원이라는 뜻) | |
- 캐시백 포인트는 최대 300원 | |
- 즉 캐시백은 총 100, 200, 300원이 존재 | |
*/ | |
public class CashBack { | |
public static void main(String[] args) { |
NewerOlder