{"id":47681,"date":"2022-04-01T16:37:34","date_gmt":"2022-04-01T16:37:34","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/write-a-program-that-creates-a-scintillation-grid\/"},"modified":"2022-04-01T16:37:34","modified_gmt":"2022-04-01T16:37:34","slug":"write-a-program-that-creates-a-scintillation-grid","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/write-a-program-that-creates-a-scintillation-grid\/","title":{"rendered":"Write a program that creates a scintillation grid"},"content":{"rendered":"<div>\n<p>\/**<br \/>\u00a0* @author\u00a0 &lt;Your name here&gt;<br \/>\u00a0* @version &lt;Date&gt;<br \/>\u00a0* CS312 Assignment 3.<br \/>\u00a0* On my honor, &lt;NAME&gt;, this programming assignment is my own work and I have<br \/>\u00a0* not shared my solution with any other student in the class.<br \/>\u00a0*<br \/>\u00a0*<br \/>\u00a0* A program to print out various ScintillationGrids. Part 2 of assignment 3.<br \/>\u00a0* Worth 16 points.<br \/>\u00a0*<br \/>\u00a0*\u00a0 email address:<br \/>\u00a0*\u00a0 UTEID:<br \/>\u00a0*\u00a0 Section 5 digit ID:<br \/>\u00a0*\u00a0 Grader name:<br \/>\u00a0*\u00a0 Number of slip days used on this assignment:<br \/>\u00a0*\/<\/p>\n<p>import java.awt.*;<br \/>public class ScintillationGrid {<br \/>\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \/\/public static int x, y, Size, NumberOfLines, LineThickness;<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 int width = 900, height = 650;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Size of panel<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DrawingPanel p = new DrawingPanel(width, height);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 p.setBackground(Color.CYAN);\u00a0\u00a0\u00a0 \/\/ Cyan background of panel<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Graphics pen = p.getGraphics();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drawGrid(0, 0, 300, 3, 6, pen);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 public static void drawGrid(int x, int y, int Size, int NumberOfLines, int LineThickness, Graphics g){<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 int Spaces = (Size-LineThickness*NumberOfLines)\/(NumberOfLines + 1) ;<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/g.drawRect(x, y, Size, Size);\u00a0\u00a0\u00a0 \/\/ Draws grid<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.setColor(Color.BLACK);\u00a0\u00a0\u00a0 \/\/ Sets color of grid to Black<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.fillRect(x, y, Size, Size);\u00a0\u00a0\u00a0 \/\/ Fills the grid color to Black<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/g.drawRect(70, 0, 6, 300);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/g.setColor(Color.LIGHT_GRAY);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/g.fillRect(70, 0, 6, 300);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 for(int i=1; i&lt;=NumberOfLines; i++){\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/\u00a0\u00a0\u00a0 Draws the gray rectangles as vertical lines in the grid<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/g.drawRect(x + (Size \/ (NumberOfLines + 1)) * (i+1) &#8211; LineThickness \/ 2, y, LineThickness, Size);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.setColor(Color.LIGHT_GRAY);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.fillRect(x + (Size \/ (NumberOfLines + 1)) * (i+1) &#8211; LineThickness \/ 2, y, LineThickness, Size);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 }\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/horizontalLines(x, y, NumberOfLines, LineThickness, Size, g);\u00a0\u00a0\u00a0 \/\/\u00a0\u00a0\u00a0 Draws the gray rectangles as horizontal lines in the grid<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 public static void horizontalLines(int x, int y, int NumberOfLines, int LineThickness, int Size, Graphics g){<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 int Spaces = (Size+LineThickness)\/(NumberOfLines + 1) ;<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 for(int i=1; i&lt;=NumberOfLines; i++){\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \/\/\u00a0\u00a0\u00a0 Draws the gray rectangles as vertical lines in the grid<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.drawRect(x, i*LineThickness+(i-1)*Spaces, LineThickness, Size);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.setColor(Color.LIGHT_GRAY);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.fillRect(x, i*LineThickness+(i-1)*Spaces, LineThickness, Size);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 }<br \/>}\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 public static void circles(int x, int y, int NumberOfLines, int LineThickness, int Size, Graphics g){<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 int Spaces = (Size+LineThickness)\/(NumberOfLines + 1) ;<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 for(int d=1; d&lt;=NumberOfLines; d++){<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 for(int w=0; w&lt;NumberOfLines; w++){<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.drawOval(x, y+Spaces, LineThickness, LineThickness);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.setColor(Color.WHITE);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 g.fillOval(x, y+Spaces, LineThickness, LineThickness);<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 y+=Spaces;<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\/**\u00a0* @author\u00a0 &lt;Your name here&gt;\u00a0* @version &lt;Date&gt;\u00a0* CS312 Assignment 3.\u00a0* On my honor, &lt;NAME&gt;, this programming assignment is my own work and I have\u00a0* not shared my solution with any other student in the class.\u00a0*\u00a0*\u00a0* A program to print out various ScintillationGrids. Part 2 of assignment 3.\u00a0* Worth 16 points.\u00a0*\u00a0*\u00a0 email address:\u00a0*\u00a0 UTEID:\u00a0*\u00a0 Section 5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-47681","post","type-post","status-publish","format-standard","hentry","category-education"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/47681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=47681"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/47681\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=47681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=47681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=47681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}