Question

In: Computer Science

What would the pseudocode look like for this UML class diagram? Class - oranges: String -...

What would the pseudocode look like for this UML class diagram?

Class
- oranges: String
- bananas: String
- grapes: String
- apples: String
+ Class(String bananas, String grapes, String apples)
+ oranges( ): void
+ isValidGrapes( ): boolean
+ isValidApples( ): boolean
+ getOranges( ): String
+ getBananas( ): String
+ setBananas(String bananas): void
+ getGrapes( ): String
+ setGrapes(String grapes): void
+ getApples( ): String
+ setApples(String apples): void

Solutions

Expert Solution

below Sample Class Code

class Friuts {
   private String oranges;
   private String bananas;
   private String grapes;
   private String apples;

//constructor
   public Friuts(String aOranges, String aBananas, String aGrapes, String aApples) {
       oranges = aOranges;
       bananas = aBananas;
       grapes = aGrapes;
       apples = aApples;
   }

//setters and getters
   public void oranges() {
   }
   public String getOranges() {
       return oranges;
   }
   public boolean isValidApples() {
       return false;
   }
   public boolean isValidGrapes() {
       return false;
   }
  
   public String getBananas() {
       return bananas;
   }
  
   public void setBananas(String aBananas) {
       bananas = aBananas;
   }
   public String getGrapes() {
       return grapes;
   }
   public void setGrapes(String aGrapes) {
       grapes = aGrapes;
   }
   public String getApples() {
       return apples;
   }
   public void setApples(String aApples) {
       apples = aApples;
   }
  
}


Related Solutions

A UML class diagram has the following description about a member of the class: + getHeaderField(name:String):String...
A UML class diagram has the following description about a member of the class: + getHeaderField(name:String):String Which of the following is a correct declaration of the member in Java? 1 public String getHeaderField(String name) 2 public String getHeaderField; 3 public String getHeaderField(String) 4 public static String getHeaderField( name) ------------------------------------------------------------------------------------------------------------------------------------- Note: all answers are case sensitive. Inside a class, the declaration of a constructor looks like the following: public JButton(String text) 1. From the constructor, you infer that the name of...
Draw UML diagram Define a class named Document that contains a member variable of type string...
Draw UML diagram Define a class named Document that contains a member variable of type string named text that stores any textual content for the document. Create a function named getText that returns the text field and a way to set this value. Next, define a class for Email that is derived from Document and that includes member variables for the sender , recipient , and title of an e-mail message. Implement appropriate accessor and mutator functions. The body of...
UML Diagram for this java code //java code import java.util.*; class Message { private String sentence;...
UML Diagram for this java code //java code import java.util.*; class Message { private String sentence; Message() { sentence=""; } Message(String text) { setSentence(text); } void setSentence(String text) { sentence=text; } String getSentence() { return sentence; } int getVowels() { int count=0; for(int i=0;i<sentence.length();i++) { char ch=sentence.charAt(i); if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' || ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U') { count=count+1; } } return count; } int getConsonants() { int count=0; for(int i=0;i<sentence.length();i++)...
create the UML Diagram to model a Movie/TV viewing site. Draw a complete UML class diagram...
create the UML Diagram to model a Movie/TV viewing site. Draw a complete UML class diagram which shows: Classes (Only the ones listed in bold below) Attributes in classes (remember to indicate privacy level, and type) No need to write methods Relationships between classes (has is, is a, ...) Use a program like Lucid Cart and then upload your diagram. Each movie has: name, description, length, list of actors, list of prequals and sequals Each TV Show has: name, description,...
Draw a UML diagram for the classes. Code for UML: // Date.java public class Date {...
Draw a UML diagram for the classes. Code for UML: // Date.java public class Date {       public int month;    public int day;    public int year;    public Date(int month, int day, int year) {    this.month = month;    this.day = day;    this.year = year;    }       public Date() {    this.month = 0;    this.day = 0;    this.year = 0;    } } //end of Date.java // Name.java public class Name...
I need a pseudocode and UML for this program. import java.util.Random; public class SortandSwapCount {   ...
I need a pseudocode and UML for this program. import java.util.Random; public class SortandSwapCount {    public static void main(String[] args) {        //Generate random array for test and copy that into 3 arrays        int[] arr1=new int[20];        int[] arr2=new int[20];        int[] arr3=new int[20];        int[] arr4=new int[20];        Random rand = new Random();        for (int i = 0; i < arr1.length; i++) {            //Generate random array...
Draw a UML diagram that describes a class that will be used to describe a product...
Draw a UML diagram that describes a class that will be used to describe a product for sale on Glamazon.com. The product has a name, a description, a price, ratings by many customers (1 to 5 stars), and a group of customer comments. New products have no ratings or comments by customers, but do have a name, description and price. The price can be changed and more customer ratings and comments can be added. A global average rating of all...
Create an array-based implementation of a binary tree. DON'T FORGET TO INCLUDE PSEUDOCODE AND UML DIAGRAM
Create an array-based implementation of a binary tree. DON'T FORGET TO INCLUDE PSEUDOCODE AND UML DIAGRAM
What would the PP schedule in Krugman’s basic diagram look like if demand became more elastic...
What would the PP schedule in Krugman’s basic diagram look like if demand became more elastic as per capita consumption increased?
Complete the following class UML design class diagram by filling in all the sections based on...
Complete the following class UML design class diagram by filling in all the sections based on the information given below.         The class name is Boat, and it is a concrete entity class. All three attributes are private strings with initial null values. The attribute boat identifier has the property of “key.” The other attributes are the manufacturer of the boat and the model of the boat. Provide at least two methods for this class. Class Name: Attribute Names: Method...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT