Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1주차 Assignment - 이서영 #11

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package assigns;

class Cylinder {
public double PI = 3.14;
int x, y;
double r;//
int height = 10;//
public Cylinder(int x, int y, double r) {
this.x = x;
this.y = y;
this.r = r; // 생성자1: 정수 인자 x, y 와 실수 인자 r을 전달 받아서 해당 필드 값을 초기화
}

public Cylinder(int x, int y, int height, double r) {
this.x = x;
this.y = y;
this.height = height;
this.r = r; // 생성자2: 정수 인자 x, y, height 와 실수 인자 r을 전달 받아서 해당 필드 값을 초기화
}

public double circleArea() {

return PI * r * r; // circleArea 메서드: PI를 이용하여 원의 면적 반환
}

public double volume() {
return PI * r * r * height;// volume 메서드: 면적과 높이를 이용하여 부피를 반환
}

public double surfaceArea() {
return 2 * PI * r * r + 2 * PI * r * height;// surfaceArea 메서드: PI를 이용하여 원기둥의 겉넓이를 반환
}

public Cylinder move(int dx, int dy) {
x += dx;
y += dy;
return this;// move 메서드: 정수 인자 dx, dy를 전달 받아서 원의 중심 좌표를 이동
// - 예: 필드 x가 1이고 dx가 10이면 x는 11로 변경되어야 함
// 객체 자신을 반환
}

void print() {

System.out.println("<" + x + "," + y + ":" + r + ">");

}
}

// 메인메서드 수행시 이렇게 출력되도록
//<13,15:6.0>
//113.04
//1130.4
//602.88
//<17,25:10.0>
//314.0
//1570.0
//942.0
public class Test1 {
public static void main(String[] args) {
Cylinder c1 = new Cylinder(3,5, 6);
c1.move(10,10).print();
System.out.println(c1.circleArea());
System.out.println(c1.volume());
System.out.println(c1.surfaceArea());

Cylinder c2 = new Cylinder(5,8, 10, 5);
c2.move(12,17).print();
System.out.println(c2.circleArea());
System.out.println(c2.volume());
System.out.println(c2.surfaceArea());
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package bj_10810;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int N = sc.nextInt();
int[] arr = new int[N];
int M = sc.nextInt();

for (int i = 0; i < M; i++) {
int I = sc.nextInt();
int J = sc.nextInt();
int K = sc.nextInt();

for (int j = I - 1; j < J; j++) {
arr[j] = K;
}
}
for (int k = 0; k < arr.length; k++) {
System.out.print(arr[k] + " ");
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package bj_11201;
import java.util.Scanner;

public class Main {
public static void main(String args[]) {

Scanner in = new Scanner(System.in);

int a = in.nextInt();

for (int i = 1; i <= a; i++) {
int c = in.nextInt();
int d = in.nextInt();

System.out.println("Case #" + i + ": " + (c + d));
}

in.close();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package bj_2439;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

int N = sc.nextInt();

for(int i = 1; i <= N; i++) {
for(int j = 1; j <= N - i; j++){
System.out.print(" ");
}
for(int k = 1; k <= i; k++){
System.out.print("*");
}
System.out.println();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package bj_2588;
import java.util.Scanner;
public class Main {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);

int A = in.nextInt();
String B = in.next();

in.close();

System.out.println(A * (B.charAt(2) - '0'));
System.out.println(A * (B.charAt(1) - '0'));
System.out.println(A * (B.charAt(0) - '0'));
System.out.println(A * Integer.parseInt(B));

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading