Untitled
unknown
java
10 days ago
1.6 kB
3
Indexable
Never
assisgnment1 public class Assignment{ int tasks; String difficulty; boolean submission; public void printDetails(){ System.out.println("Number of tasks:"+tasks); System.out.println("Difficulty level:"+difficulty); System.out.println("Submission required:"+submission); } public void makeOptional(){ if(submission==true){ System.out.println("Assignment will not require submission"); } else{ System.out.println("Submission is already not required"); } } } assignment 02 public class Shelf{ int capacity; int books; public void showDetails(){ System.out.println("Shelf capacity:"+capacity); System.out.println("Number of books:"+books); } public void addBooks(int a){ int b=a+books; if(capacity==0){ System.out.println("Zero capacity. Cannot add books."); } else if(capacity<b){ System.out.println("Exceeds capacity"); else if(capacity>b){ System.out.println(b+"books added to shelf"); this.books+=b; } } } } assignment 07 public class Coourse2{ String name; String code; String[]syllabus=new String[4]; int coursecount; public void createCourse(String a,String b){ name=a; code=b; } public void printDetails(){ System.out.println("Course details:" +\n +"Course Code:"+code); if(coursecount==0){ System.out.println("No content yet."); } else if(syllabus.length< } public void addContent(String p){ System.out.println(p+"was added."); if(coursecount>=p){ syllabus[coursecount++]=p; }
Leave a Comment