Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //if it is not working please set the file and folder permissions to full.
- import java.io.BufferedWriter;
- import java.io.File;
- import java.io.FileWriter;
- import java.util.Scanner;
- public class Problem10 {
- public static void main(String args[])
- {
- Scanner input = new Scanner(System.in);
- FileWriter fWriter = null;
- BufferedWriter writer = null;
- FileWriter styleWriter = null;
- BufferedWriter cssWriter = null;
- System.out.println("Please enter roof's width here: ");
- double roofWidth = input.nextDouble();
- System.out.println("Please enter body of the house width: ");
- double bodyWidth = input.nextDouble();
- System.out.println("Please enter body of the house height: ");
- double bodyHeight = input.nextDouble();
- try {
- File htmlFile = new File("C:/dok/file.html");
- File cssFile = new File("C:/dok/stylesheet.css");
- fWriter = new FileWriter(htmlFile);
- styleWriter = new FileWriter(cssFile);
- writer = new BufferedWriter(fWriter);
- cssWriter = new BufferedWriter(styleWriter);
- cssWriter.write(
- ".arrow-up {\n"+
- "width: 0;\n"+
- "height: 0;\n"+
- "margin-left:20%;\n"+
- "margin-top:250px;\n"+
- "border-left: " + roofWidth + " solid transparent;\n"+
- "border-right: " + roofWidth + " solid transparent;\n"+
- "border-bottom: " + (roofWidth/1.5) + " solid black;\n"+
- "}\n"+
- ".bodyHouse {\n"+
- "width: " + bodyWidth + ";\n"+
- "height: " + bodyHeight + ";\n"+
- "margin-left:25%;\n"+
- "margin-top:3;\n"+
- "background-color:black;\n"+
- "}\n"+
- ".sun {\n"+
- "border-radius: 50%;\n"+
- "width: 100px;\n"+
- "height: 100px; \n"+
- "margin-left:70%;\n"+
- "margin-top:10%;\n"+
- "background-color:yellow;\n"+
- "}\n"+
- ".grass {\n"+
- "width: 1024;\n "+
- "height: 70; \n"+
- "background-color:green;\n"+
- "margin-top:0;\n"+
- "}"
- );
- cssWriter.close();
- writer.write("Software University</b>");
- writer.write("</body></html>");
- writer.write("<html><head><LINK href=\"stylesheet.css\" rel=\"stylesheet\" type=\"text/css\"></head><body>");
- writer.write(
- "<div class=\"sun\"></div>\n"+
- "<div class=\"arrow-up\"></div>\n"+
- "<div class=\"bodyHouse\"></div>\n"+
- "<div class=\"grass\"></div>\n"
- );
- writer.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement