Write a Java program called Departure contained in 1 Java so

Write a Java program called Departure contained in 1 Java source file that generates the following output. Use static methods to show structure and eliminate redundancy in your solution. Mote: replace \"Student Name\" with your actual name. Output starts below this line

Solution

// class Departure starts here

public class Departure {

// header is static(as mentioned in question) function to print the details

public static void header()
{
System.out.println(\"Output starts below this line ----------------------\");

// pls edit your name
System.out.println(\"Student Name\");
System.out.println(\"CSC 1301 - Spring 2017\");
System.out.println(\"Programming Assignment 1\");
System.out.println(\"Due: 1/17/2017\");
}

// triangle1 is static(as mentioned in question) function to print the first triangle
public static void triangle1()
{

// here \"\\\\\" is used to print the \"\\\" on output window, as it is a escape sequence character
System.out.println(\" /\\\\\");
System.out.println(\" / \\\\\");
System.out.println(\" / \\\\\");
System.out.println(\" ------\");
}

// triangle2 is static(as mentioned in question) function to print the second triangle
public static void triangle2()
{
System.out.println(\" ------\");
System.out.println(\" \\\\ /\");
System.out.println(\" \\\\ /\");
System.out.println(\" \\\\/\");
  
}

// x is static(as mentioned in question) function to print the \"X\" shape
public static void x()
{
System.out.println(\" \\\\ /\");
System.out.println(\" \\\\ /\");
System.out.println(\" \\\\/\");
System.out.println(\" /\\\\\");
System.out.println(\" / \\\\\");
System.out.println(\" / \\\\\");
}

// square is static(as mentioned in question) function to print the square
public static void square()
{
System.out.println(\" --------\");
System.out.println(\" | |\");
System.out.println(\" | |\");
System.out.println(\" | |\");
System.out.println(\" --------\");
}

// footer is static(as mentioned in question) function to print the end line
public static void footer()
{
System.out.println(\"Output ends above this line ----------------------\");
}
public static void main(String[] args) {
// call all functions here one by one
header();

// to print a blank line

  System.out.println(\"\");
triangle1();

System.out.println(\"\");
triangle2();

System.out.println(\"\");
x();

System.out.println(\"\");
square();

footer();
}
}

 Write a Java program called Departure contained in 1 Java source file that generates the following output. Use static methods to show structure and eliminate r
 Write a Java program called Departure contained in 1 Java source file that generates the following output. Use static methods to show structure and eliminate r

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site