I need help with my programming assignment. Here are the assginement requirement
ID: 3582045 • Letter: I
Question
I need help with my programming assignment.
Here are the assginement requirements and I need it to be done fore the letter A.
Assignment :
For your final assignment, please use Listings 14.14 and 14.15.
I want you to create a simple Java program that uses lines to create your first name initial.
If your first initial is a "J" the trick is... your initial letters won't look nice and round. But you will need to add different coordinates until it forms an idea of your initial.
So J would look like this:
__
_|
Add a text that includes a small quote/saying that is fun, formatted three ways just like in the textbook.
Listing 14.14
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.geometry.Insets;
import javafx.stage.Stage;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.FontPosture;
public class ShowText extends Application{
@Override
public void start(Stage primaryStage) {
Pane pane = new Pane();
pane.setPadding(new Insets(5, 5, 5, 5));
Text text1 = new Text(20, 20, "Programming is fun");
text1.setFont(Font.font("Courier", FontWeight.BOLD,
FontPosture.ITALIC, 15));
pane.getChildren().add(text1);
Text text2 = new Text(60, 60, "Programming is fun Display text");
pane.getChildren().add(text2);
Text text3 = new Text(10, 100, "Programming is fun Display text");
text3.setFill(Color.RED);
text3.setUnderline(true);
text3.setStrikethrough(true);
pane.getChildren().add(text3);
Scene scene = new Scene(pane);
primaryStage.setTitle("ShowText");
primaryStage.setScene(scene);
primaryStage.show();
}
}
Listing 14.15
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.shape.Line;
public class ShowLine extends Application{
@Override
public void start(Stage primaryStage){
Scene scene = new Scene(new LinePane(), 200, 200);
primaryStage.setTitle("ShowLine");
primaryStage.setScene(scene);
primaryStage.show();
}
}
class LinePane extends Pane {
public LinePane() {
Line line1 = new Line(10, 10, 10, 10);
line1.endXProperty().bind(widthProperty().subtract(10));
line1.endYProperty().bind(heightProperty().subtract(10));
line1.setStrokeWidth(5);
line1.setStroke(Color.GREEN);
getChildren().add(line1);
Line line2 = new Line(10, 10, 10, 10);
line2.startXProperty().bind(widthProperty().subtract(10));
line2.endYProperty().bind(heightProperty().subtract(10));
line2.setStrokeWidth(5);
line2.setStroke(Color.GREEN);
getChildren().add(line2);
}
}
Thank you!
Explanation / Answer
public class Initials {
public static void main(String[] args) {
System.out.println(" ------------");
System.out.println(" ------------");
System.out.println(" ---");
System.out.println(" ---");
System.out.println(" ---");
System.out.println(" ---");
System.out.println("--- ---");
System.out.println("--- ---");
System.out.println("--- ---");
System.out.println("-----------");
System.out.println("-----------");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.