Instructions are labeled below. Supporting documents are in the wikisend link. T
ID: 3530982 • Letter: I
Question
Instructions are labeled below. Supporting documents are in the wikisend link. The program should read and print the names of flowers (see picture) and whether they are grown in shade or sun. 1. Using the picture declare the variable(s) you will need 2. Write the Java statement that will open the input file flowers.dat (files shared) 3. Write a while loop to read the input until the EOF is reached 4. In the body of the loop, print the name of each flower and whether it's grown in shade or sun. 5. Save file in a working directory 6. Compile source code file Flowers.java 7. Program must execute properly http://wikisend.com/download/935940/Flower.zipExplanation / Answer
package com.flower.finder;
import android.os.Parcel;
import android.os.Parcelable;
public class Flower implements Parcelable{
private int _bloomStart;
private int _bloomEnd;
private String _location;
private String _fileName;
private String _commonName;
private String _latinName;
//private double[] _features;
public Flower(int bloomStart, int bloomEnd, String location,
String fileName, String commonName, String latinName){
//,double[] features) {
super();
_bloomStart = bloomStart;
_bloomEnd = bloomEnd;
_location = location;
_fileName = fileName;
_commonName = commonName;
_latinName = latinName;
//_features = features;
}
public int getBloomStart() {
return _bloomStart;
}
public void setBloomStart(int bloomStart) {
_bloomStart = bloomStart;
}
public int getBloomEnd() {
return _bloomEnd;
}
public void setBloomEnd(int bloomEnd) {
_bloomEnd = bloomEnd;
}
public String getLocation() {
return _location;
}
public void setLocation(String location) {
_location = location;
}
public String getFileName() {
return _fileName;
}
public void setFileName(String fileName) {
_fileName = fileName;
}
public String getCommonName() {
return _commonName;
}
public void setCommonName(String commonName) {
_commonName = commonName;
}
public String getLatinName() {
return _latinName;
}
public void setLatinName(String latinName) {
_latinName = latinName;
}
/*public double[] getFeatures() {
return _features;
}
public void setFeatures(double[] features) {
_features = features;
}*/
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flag) {
out.writeInt(_bloomStart);
out.writeInt(_bloomEnd);
out.writeString(_location);
out.writeString(_fileName);
out.writeString(_commonName);
out.writeString(_latinName);
}
public static final Parcelable.Creator<Flower> CREATOR = new Parcelable.Creator<Flower>() {
public Flower createFromParcel(Parcel in) {
return new Flower(in);
}
public Flower[] newArray(int size) {
return new Flower[size];
}
};
public Flower(Parcel in) {
this(in.readInt(), in.readInt(),in.readString(),in.readString(),in.readString(),in.readString());
}
}