new week new boring stuff
This commit is contained in:
parent
1a6c028ac5
commit
701da5eb0e
10
dropbox16/.classpath
Normal file
10
dropbox16/.classpath
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path=""/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
||||||
17
dropbox16/.project
Normal file
17
dropbox16/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>dropbox16</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
2
dropbox16/.settings/org.eclipse.core.resources.prefs
Normal file
2
dropbox16/.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
4
dropbox16/dropbox16/.gitignore
vendored
Normal file
4
dropbox16/dropbox16/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/Book.class
|
||||||
|
/Author.class
|
||||||
|
/Publisher.class
|
||||||
|
/BookTest.class
|
||||||
45
dropbox16/dropbox16/Author.java
Normal file
45
dropbox16/dropbox16/Author.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 16
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox16;
|
||||||
|
public class Author {
|
||||||
|
// fields
|
||||||
|
private String name;
|
||||||
|
private String bio;
|
||||||
|
// accessors
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public String getBio() {
|
||||||
|
return bio;
|
||||||
|
}
|
||||||
|
// mutators
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public void setBio(String bio) {
|
||||||
|
this.bio = bio;
|
||||||
|
}
|
||||||
|
// constructors
|
||||||
|
public Author() {
|
||||||
|
}
|
||||||
|
public Author(String name, String bio) {
|
||||||
|
this.name = name;
|
||||||
|
this.bio = bio;
|
||||||
|
}
|
||||||
|
public Author(Author author) {
|
||||||
|
this.name = author.getName();
|
||||||
|
this.bio = author.getBio();
|
||||||
|
}
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("%nName: %s%nBio: %s",
|
||||||
|
getName(), getBio());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
68
dropbox16/dropbox16/Book.java
Normal file
68
dropbox16/dropbox16/Book.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 16
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox16;
|
||||||
|
public class Book {
|
||||||
|
// fields
|
||||||
|
private String isbn;
|
||||||
|
private String title;
|
||||||
|
private Author primaryAuthor;
|
||||||
|
private int copyrightYear;
|
||||||
|
private Publisher publisher;
|
||||||
|
// accessors
|
||||||
|
public String getIsbn() {
|
||||||
|
return isbn;
|
||||||
|
}
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public Author getPrimaryAuthor() {
|
||||||
|
return new Author(primaryAuthor);
|
||||||
|
}
|
||||||
|
public int getCopyrightYear() {
|
||||||
|
return copyrightYear;
|
||||||
|
}
|
||||||
|
public Publisher getPublisher() {
|
||||||
|
return new Publisher(publisher);
|
||||||
|
}
|
||||||
|
// mutators
|
||||||
|
public void setIsbn(String isbn) {
|
||||||
|
this.isbn = isbn;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
public void setAuthor(String primaryAuthor, String bio) {
|
||||||
|
this.primaryAuthor = new Author(primaryAuthor, bio);
|
||||||
|
}
|
||||||
|
public void setCopyrightYear(int copyrightYear) {
|
||||||
|
this.copyrightYear = copyrightYear;
|
||||||
|
}
|
||||||
|
public void setPublisher(Publisher publisher) {
|
||||||
|
this.publisher = new Publisher(publisher);
|
||||||
|
}
|
||||||
|
// constructors
|
||||||
|
public Book() {
|
||||||
|
}
|
||||||
|
public Book(String isbn, String title, String primaryAuthor,
|
||||||
|
String bio, int copyrightYear, Publisher publisher) {
|
||||||
|
this.isbn = isbn;
|
||||||
|
this.title = title;
|
||||||
|
this.primaryAuthor = new Author(primaryAuthor, bio);
|
||||||
|
this.copyrightYear = copyrightYear;
|
||||||
|
this.publisher = new Publisher(publisher);
|
||||||
|
}
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("Book information%nISBN: %s%nTitle: %s%n"
|
||||||
|
+ "Primary author: %s%nCopyright year: %d%n%s%n",
|
||||||
|
getIsbn(), getTitle(), getPrimaryAuthor(),
|
||||||
|
getCopyrightYear(), getPublisher());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
20
dropbox16/dropbox16/BookTest.java
Normal file
20
dropbox16/dropbox16/BookTest.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 16
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox16;
|
||||||
|
public class BookTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// variables and objects
|
||||||
|
String primaryAuthor = "Lynn Smith";
|
||||||
|
String bio = "Author of several typos.";
|
||||||
|
Publisher publisher = new Publisher("Smith Publishing",
|
||||||
|
"(123) 456-7890");
|
||||||
|
Book book = new Book("9870123456789",
|
||||||
|
"Java Examples", primaryAuthor, bio, 2023, publisher);
|
||||||
|
// display
|
||||||
|
System.out.println(book);
|
||||||
|
}
|
||||||
|
}
|
||||||
45
dropbox16/dropbox16/Publisher.java
Normal file
45
dropbox16/dropbox16/Publisher.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 16
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox16;
|
||||||
|
public class Publisher {
|
||||||
|
// fields
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
|
// accessors
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
// mutators
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
// constructors
|
||||||
|
public Publisher() {
|
||||||
|
}
|
||||||
|
public Publisher(String name, String phone) {
|
||||||
|
this.name = name;
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
public Publisher(Publisher publisher) {
|
||||||
|
this.name = publisher.getName();
|
||||||
|
this.phone = publisher.getPhone();
|
||||||
|
}
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("Publisher Name: %s%nPhone: %s%n",
|
||||||
|
getName(), getPhone());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
10
dropbox17/.classpath
Normal file
10
dropbox17/.classpath
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path=""/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
||||||
17
dropbox17/.project
Normal file
17
dropbox17/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>dropbox17</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
2
dropbox17/.settings/org.eclipse.core.resources.prefs
Normal file
2
dropbox17/.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
7
dropbox17/dropbox17/.gitignore
vendored
Normal file
7
dropbox17/dropbox17/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/Course.class
|
||||||
|
/Instructor.class
|
||||||
|
/classroom.class
|
||||||
|
/Classroom.class
|
||||||
|
/Required_Book.class
|
||||||
|
/Course_Test.class
|
||||||
|
/BookTest.class
|
||||||
58
dropbox17/dropbox17/Classroom.java
Normal file
58
dropbox17/dropbox17/Classroom.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 17
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox17;
|
||||||
|
|
||||||
|
public class Classroom {
|
||||||
|
|
||||||
|
// fields
|
||||||
|
private String room_number;
|
||||||
|
private String bldg_name;
|
||||||
|
private String seat_cap;
|
||||||
|
|
||||||
|
// accessors
|
||||||
|
public String getRoom_Number() {
|
||||||
|
return room_number;
|
||||||
|
}
|
||||||
|
public String getBldg_Name() {
|
||||||
|
return bldg_name;
|
||||||
|
}
|
||||||
|
public String getSeat_Cap() {
|
||||||
|
return seat_cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mutators
|
||||||
|
public void setRoom_Number(String room_number) {
|
||||||
|
this.room_number = room_number;
|
||||||
|
}
|
||||||
|
public void setBldg_Name(String bldg_name) {
|
||||||
|
this.bldg_name = bldg_name;
|
||||||
|
}
|
||||||
|
public void setSeat_Cap(String seat_cap) {
|
||||||
|
this.seat_cap = seat_cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
// constructors
|
||||||
|
public Classroom(String room_number, String bldg_name, String seat_cap) {
|
||||||
|
this.room_number = room_number;
|
||||||
|
this.bldg_name = bldg_name;
|
||||||
|
this.seat_cap = seat_cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Classroom(Classroom classroom) {
|
||||||
|
this.room_number = classroom.getRoom_Number();
|
||||||
|
this.bldg_name = classroom.getBldg_Name();
|
||||||
|
this.seat_cap = classroom.getSeat_Cap();
|
||||||
|
}
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("%nRoom Number: %s%nBLDG Name: %s%nSeat Cap: %s",
|
||||||
|
getRoom_Number(), getBldg_Name(), getSeat_Cap());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
94
dropbox17/dropbox17/Course.java
Normal file
94
dropbox17/dropbox17/Course.java
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 17
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox17;
|
||||||
|
public class Course {
|
||||||
|
|
||||||
|
// fields
|
||||||
|
private String course_number; // could be alphanumeric
|
||||||
|
private String title;
|
||||||
|
private String start_date_time;
|
||||||
|
private String semester;
|
||||||
|
|
||||||
|
private Instructor instructor;
|
||||||
|
private Required_Book required_book;
|
||||||
|
private Classroom classroom;
|
||||||
|
|
||||||
|
// accessors
|
||||||
|
public String getCourse_Number(){
|
||||||
|
return course_number;
|
||||||
|
}
|
||||||
|
public String getTitle(){
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public String getStart_Date_Time(){
|
||||||
|
return start_date_time;
|
||||||
|
}
|
||||||
|
public String getSemester(){
|
||||||
|
return semester;
|
||||||
|
}
|
||||||
|
public Classroom getClassroom(){
|
||||||
|
return new Classroom(classroom);
|
||||||
|
}
|
||||||
|
public Instructor getInstructor(){
|
||||||
|
return new Instructor(instructor);
|
||||||
|
}
|
||||||
|
public Required_Book getRequired_Book(){
|
||||||
|
return new Required_Book(required_book);
|
||||||
|
}
|
||||||
|
|
||||||
|
// mutators
|
||||||
|
public void setCourseNumber(String course_number){
|
||||||
|
this.course_number = course_number;
|
||||||
|
}
|
||||||
|
public void setTitle(String title){
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
public void setStart_Date_Time(String start_date_time){
|
||||||
|
this.start_date_time = start_date_time;
|
||||||
|
}
|
||||||
|
public void setSemester(String semester){
|
||||||
|
this.semester = semester;
|
||||||
|
}
|
||||||
|
// here are the 3 classes required
|
||||||
|
public void setInstructor(Instructor instructor_name) {
|
||||||
|
this.instructor = new Instructor(instructor_name);
|
||||||
|
}
|
||||||
|
public void setClassroom(Classroom classroom) {
|
||||||
|
this.classroom = new Classroom(classroom);
|
||||||
|
}
|
||||||
|
// here is the composite
|
||||||
|
public void setRequired_Book(Required_Book required_book) {
|
||||||
|
this.required_book = new Required_Book(required_book);
|
||||||
|
}
|
||||||
|
|
||||||
|
// constructors
|
||||||
|
public Course() {
|
||||||
|
}
|
||||||
|
public Course(String course_number, String title, String start_date_time,
|
||||||
|
String semester, Instructor instructor, Required_Book required_book,
|
||||||
|
Classroom classroom) {
|
||||||
|
|
||||||
|
this.course_number = course_number;
|
||||||
|
this.title = title;
|
||||||
|
this.start_date_time = start_date_time;
|
||||||
|
this.semester = semester;
|
||||||
|
this.instructor = new Instructor(instructor);
|
||||||
|
this.required_book = new Required_Book(required_book);
|
||||||
|
this.classroom = new Classroom(classroom);
|
||||||
|
}
|
||||||
|
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("%nCourse information%nCourse Number: %s%nTitle: %s%n"
|
||||||
|
+ "Time: %s%nSemester: %s%n%nInstructor infomation%s%n%nRequired Book Information%n%s%nClassroom%s%n",
|
||||||
|
getCourse_Number(), getTitle(), getStart_Date_Time(),
|
||||||
|
getSemester(), getInstructor(), getRequired_Book(), getClassroom());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
32
dropbox17/dropbox17/Course_Test.java
Normal file
32
dropbox17/dropbox17/Course_Test.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* Assignment 16
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox17;
|
||||||
|
|
||||||
|
public class Course_Test {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// Fill
|
||||||
|
String course_number = "123456";
|
||||||
|
String title = "Under Water Basket Weaving";
|
||||||
|
String start_date_time = "Midnight, December 25, 2025";
|
||||||
|
String semester = "Foo Bar";
|
||||||
|
|
||||||
|
Instructor instructor = new Instructor("Bob Smith", "007") ;
|
||||||
|
Required_Book required_book = new Required_Book("A Short History of Nearly Everything","978-0767908184");
|
||||||
|
Classroom classroom = new Classroom("237", "The Overlook Hotel", "1");
|
||||||
|
|
||||||
|
Course course = new Course(
|
||||||
|
course_number,
|
||||||
|
title,
|
||||||
|
start_date_time,
|
||||||
|
semester,
|
||||||
|
instructor,
|
||||||
|
required_book,
|
||||||
|
classroom);
|
||||||
|
// Dump
|
||||||
|
System.out.println(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
46
dropbox17/dropbox17/Instructor.java
Normal file
46
dropbox17/dropbox17/Instructor.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 17
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox17;
|
||||||
|
|
||||||
|
public class Instructor {
|
||||||
|
// fields
|
||||||
|
private String name;
|
||||||
|
private String instructor_id;
|
||||||
|
// accessors
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public String getInstructor_ID() {
|
||||||
|
return instructor_id;
|
||||||
|
}
|
||||||
|
// mutators
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public void setInstructor_ID(String instructor_id) {
|
||||||
|
this.instructor_id = instructor_id;
|
||||||
|
}
|
||||||
|
// constructors
|
||||||
|
public Instructor() {
|
||||||
|
}
|
||||||
|
public Instructor(String name, String instructor_id) {
|
||||||
|
this.name = name;
|
||||||
|
this.instructor_id = instructor_id;
|
||||||
|
}
|
||||||
|
public Instructor(Instructor instructor) {
|
||||||
|
this.name = instructor.getName();
|
||||||
|
this.instructor_id = instructor.getInstructor_ID();
|
||||||
|
}
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("%nInstructor Name: %s%nID: %s",
|
||||||
|
getName(), getInstructor_ID());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
48
dropbox17/dropbox17/Required_Book.java
Normal file
48
dropbox17/dropbox17/Required_Book.java
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 17
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 02, 2025
|
||||||
|
*/
|
||||||
|
package dropbox17;
|
||||||
|
|
||||||
|
public class Required_Book {
|
||||||
|
|
||||||
|
// fields
|
||||||
|
private String book_name;
|
||||||
|
private String isbn;
|
||||||
|
|
||||||
|
// accessors
|
||||||
|
public String getBook_Name() {
|
||||||
|
return book_name;
|
||||||
|
}
|
||||||
|
public String getISBN() {
|
||||||
|
return isbn;
|
||||||
|
}
|
||||||
|
// mutators
|
||||||
|
public void setBook_Name(String book_name) {
|
||||||
|
this.book_name = book_name;
|
||||||
|
}
|
||||||
|
public void setISBN(String isbn) {
|
||||||
|
this.isbn = isbn;
|
||||||
|
}
|
||||||
|
// constructors
|
||||||
|
public Required_Book() {
|
||||||
|
}
|
||||||
|
public Required_Book(String book_name, String isbn) {
|
||||||
|
this.book_name = book_name;
|
||||||
|
this.isbn = isbn;
|
||||||
|
}
|
||||||
|
public Required_Book(Required_Book required_book) {
|
||||||
|
this.book_name = required_book.getBook_Name();
|
||||||
|
this.isbn = required_book.getISBN();
|
||||||
|
}
|
||||||
|
// toString
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str;
|
||||||
|
str = String.format("Required Book Name: %s%nISBN: %s%n",
|
||||||
|
getBook_Name(), getISBN());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
10
dropbox18/.classpath
Normal file
10
dropbox18/.classpath
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path=""/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
||||||
17
dropbox18/.project
Normal file
17
dropbox18/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>dropbox18</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
2
dropbox18/.settings/org.eclipse.core.resources.prefs
Normal file
2
dropbox18/.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
3
dropbox18/dropbox18/.gitignore
vendored
Normal file
3
dropbox18/dropbox18/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/DivisionTest.class
|
||||||
|
/DivisionTest_A.class
|
||||||
|
/DivisionTest_B.class
|
||||||
28
dropbox18/dropbox18/DivisionTest.java
Normal file
28
dropbox18/dropbox18/DivisionTest.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 18
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 03, 2025
|
||||||
|
*/
|
||||||
|
package dropbox18;
|
||||||
|
import java.util.Scanner;
|
||||||
|
public class DivisionTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner input = new Scanner(System.in);
|
||||||
|
// variables
|
||||||
|
int dividend;
|
||||||
|
int divisor;
|
||||||
|
int quotient;
|
||||||
|
// prompt user for input
|
||||||
|
System.out.println("Enter a dividend: ");
|
||||||
|
dividend = input.nextInt();
|
||||||
|
System.out.println("Enter a divisor: ");
|
||||||
|
divisor = input.nextInt();
|
||||||
|
// calculation
|
||||||
|
quotient = dividend/divisor;
|
||||||
|
// display
|
||||||
|
System.out.printf("Result: %d / %d = %d",
|
||||||
|
dividend, divisor, quotient);
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
10
dropbox19/.classpath
Normal file
10
dropbox19/.classpath
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path=""/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
||||||
17
dropbox19/.project
Normal file
17
dropbox19/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>dropbox19</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
2
dropbox19/.settings/org.eclipse.core.resources.prefs
Normal file
2
dropbox19/.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
2
dropbox19/dropbox19/.gitignore
vendored
Normal file
2
dropbox19/dropbox19/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/DivistionTest.class
|
||||||
|
/DivisionTest.class
|
||||||
40
dropbox19/dropbox19/DivisionTest.java
Normal file
40
dropbox19/dropbox19/DivisionTest.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Assignment 19
|
||||||
|
* Skill: CISS238
|
||||||
|
* Student: Scott Steely
|
||||||
|
* Date: Oct 03, 2025
|
||||||
|
*/
|
||||||
|
package dropbox19;
|
||||||
|
import java.util.InputMismatchException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
public class DivisionTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner input = new Scanner(System.in);
|
||||||
|
// variables
|
||||||
|
int dividend;
|
||||||
|
int divisor;
|
||||||
|
int quotient;
|
||||||
|
boolean continueLoop = true;
|
||||||
|
do {
|
||||||
|
try {
|
||||||
|
System.out.println("Enter a dividend: ");
|
||||||
|
dividend = input.nextInt();
|
||||||
|
System.out.println("Enter a divisor: ");
|
||||||
|
divisor = input.nextInt();
|
||||||
|
quotient = dividend/divisor;
|
||||||
|
System.out.printf("Result: %d / %d = %d%n",
|
||||||
|
dividend, divisor, quotient);
|
||||||
|
continueLoop = false;
|
||||||
|
} catch (InputMismatchException inputMismatchException) {
|
||||||
|
System.out.printf("%nException: %s%n", inputMismatchException);
|
||||||
|
input.nextLine();
|
||||||
|
System.out.println("Try again.");
|
||||||
|
} catch (ArithmeticException arithmeticException) {
|
||||||
|
System.out.printf("%nException: %s%n", arithmeticException);
|
||||||
|
input.nextLine();
|
||||||
|
System.out.println("Tru again.");
|
||||||
|
}
|
||||||
|
} while(continueLoop);
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user