Same code to do the stuff the ugly Java did:
public Form1() { InitializeComponent();Rectangle test = new Rectangle();
test.setLengthWidth(2, 6);
test.calculatePerimeter();
label1.Text = test.print();
test.setLengthWidth(12, 5);
test.calculatePerimeter();
label1.Text = label1.Text + "\n" + test.print();
}
Much prettier, and I did try “\n” in Java, but it didn’t put a carriage return /line feed in my label, while C# does.
Leave a Reply