{"id":311,"date":"2026-04-17T19:53:59","date_gmt":"2026-04-17T19:53:59","guid":{"rendered":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/?page_id=311"},"modified":"2026-04-17T19:56:45","modified_gmt":"2026-04-17T19:56:45","slug":"cs-151-intro-to-java-programming","status":"publish","type":"page","link":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/cs-151-intro-to-java-programming\/","title":{"rendered":"CS 151 &#8211; Intro to Java Programming"},"content":{"rendered":"\n<p>CS 151 serves as a foundational class to teach students the essentials of programming. The foundational concepts that CS 151 teaches are variables, data types and expressions, assignment, control-flow statements, I\/O, exception handling, functions, arrays, and classes.<\/p>\n\n\n\n<p>Here are some examples of the kind of coding that CS 151 entails.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.util.*;\r\npublic class Midterm1 {\r\n\r\n\tpublic static void main(String&#091;] args) {\r\n\t\t\/\/ Jadyn Richardson\r\n\t\t\/\/ 01221594\r\n\t\tSystem.out.print(\"How many packages were purchased? \");\r\n\t\tScanner input = new Scanner (System.in);\r\n\t\t\/\/ variable for the user to input how many products will be purchased\r\n\t\tint quantity = input.nextInt();\r\n\t\tinput.close();\r\n\t\t\/\/ creating variables for all of the numbers that will be calculated\r\n\t\tdouble discount = 0;\r\n\t\t\/\/ the price of each item is 99$\r\n\t\tdouble sum = quantity * 99;\r\n\t\tdouble amountDiscounted = 0;\r\n\t\tString qualifier = \" \";\r\n\t\tdouble discountedSum = 0;\r\n\t\t\/\/ if the quantity of the items is in between the two specified numbers, the discount variable is set to the specified numbers in the parameters of the project\r\n\t\tif(quantity &gt;= 10 &amp;&amp; quantity &lt;=19)\r\n\t\t\tdiscount = .2;\r\n\t\telse if (quantity &gt;= 20 &amp;&amp; quantity &lt;= 49)\r\n\t\t\tdiscount = .3;\r\n\t\telse if (quantity &gt;= 50 &amp;&amp; quantity &lt;= 49)\r\n\t\t\tdiscount = .4;\r\n\t\telse if (quantity &gt;= 100)\r\n\t\t\tdiscount = .5;\r\n\t\telse\r\n\t\t\tdiscount = 1;\r\n\t\t\/\/ \/\/ the qualifier line is a string that prints out what discount the user will get in percentage form\r\n\t\tqualifier = \"this purchase qualifies for a \" + discount*100 + \"% discount \";\r\n\t\t\/\/ the discounted sum is calculated by taking the sum - (sum * discount)\r\n\t\tdiscountedSum = sum - (sum * discount);\r\n\t\t\/\/ the amount discounted is the sum * discount\r\n\t\tamountDiscounted = (sum * discount);\r\n\t\t\/\/ printing out results\r\n\t\tSystem.out.println(qualifier);\r\n\t\tSystem.out.println(\"the total amount of the discount is: \" + amountDiscounted);\r\n\t\tSystem.out.println(\"The total amount of the purchase is: \" + discountedSum);\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CS 151 serves as a foundational class to teach students the essentials of programming. The foundational concepts that CS 151 teaches are variables, data types and expressions, assignment, control-flow statements, I\/O, exception handling, functions, arrays, and classes. Here are some examples of the kind of coding that CS 151 entails.<\/p>\n","protected":false},"author":27592,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/pages\/311"}],"collection":[{"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/users\/27592"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/comments?post=311"}],"version-history":[{"count":3,"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/pages\/311\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/pages\/311\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/sites.wp.odu.edu\/jadynrichardson\/wp-json\/wp\/v2\/media?parent=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}