Premium Essay

Pt1420 Unit 2 Assignment Analysis

Submitted By
Words 486
Pages 2
For the unit 2 assignment, you will develop a program that will simulate the rolling of a pair of dice. Your program must simulate rolling two dice and keep track of how many rolls are required before snake eyes are rolled (Note: “Snake Eyes” means that both dice show a value of 1). You will need to use a loop structure to repeatedly ‘roll the dice’. You will also need to make use of the if statement to determine if both die show a 1. You can use the example of an if statement below in your program and you can also read ahead to next week's lesson for more information on the if statement.

To roll the dice, you can use the following Java statement which generates a random number between 1 and 6 (to represent the six sides of the dice).

die1 = …show more content…
What the (int) in this case is doing is called a cast. The cast is a way to force java to convert data from one data type to another.

The subroutine (actually this is calling the class Math and the method random) Math.random() will return a number that is between 0 and 1. This number is a floating point number.

By multiplying it by the number 6 we will get a random number between 0 and 5. This number will be a floating point number and is likely to be a fraction meaning that it will have digits to the right of the decimal point.

What the cast or (int) in this case does is convert this number into an integer. As you recall from earlier discussions, this will truncate all the digits to the right of the decimal point. For example assume that the Math.random() subroutine returns the value of .523432. This value is then multiplied by 6 resulting in 3.14059 to this we add 1 resulting in 4.14059. The reason that we are adding a 1 is that we want a number between 1 and 6 starting at 1. By adding a 1 we know that the starting number will always be 1 or

Similar Documents

Premium Essay

Pt1420 Unit 2 Assignment 1 Math Analysis

...The area of each square is therefore 2*2=4 and the volume of each column will be 4 times the height of the right-right corner. The 6 points are therefore (4,2) xy=8 volume=32 (4,4) xy=16 volume=64 (6,2) xy=12 volume=48 (6,4) xy=24 volume=96 (8,2) xy=16 volume=64 (8,4) xy=32 volume=128 The sum of these numbers is height of a stack of columns would be 108 The sum of the volumes is 432 To check the arithmetic I also multiply 108 time 4 to get 432. Since this is a monotonically increasing situation this estimate will be greater than the actual volume. I will assume that the midpoint rule will also use the same number of sub-divisions. The points are therefore as follows x is from the set{3,5,7} and y is from the set{1.3} (3,1) xy = 3 volume=12 (3,3) xy = 9 volume=36 (5,1) xy = 5...

Words: 369 - Pages: 2

Premium Essay

Nt1230 Syllabus

...Networking I Syllabus Where Does This Course Belong? 1st QTR GS1140 NT1110 GS1145 Problem Solving Theory Computer Structure and Logic Strategies for the Technical Professional 2nd QTR NT1210 Introduction to Networking NT1230 Client-Server Networking I MA1210 College Mathematics I 3rd QTR NT1310 NT1330 MA1310 4th QTR PT1420 NT1430 EN1320 5th QTR PT2520 NT2580 EN1420 6th QTR NT2640 NT2670 CO2520 7th QTR NT2799 SP2750 Physical Networking Client-Server Networking II College Mathematics II Introduction to Programming Linux Networking Composition I Database Concepts Introduction to Information Security Composition II IP Networking Email and Web Services Communications Network Systems Administration Capstone Project Group Theory The follow diagram indicates how this course relates to other courses in the NSA program: 1 Date: 8/31/2012 Client-Server Networking I Syllabus NT2799 NSA Capstone Project NT2580 Introduction to Information Security NT2670 Email and Web Services NT2640 IP Networking PT2520 Database Concepts NT1330 Client-Server Networking II NT1230 Client-Server Networking I NT1430 Linux Networking PT1420...

Words: 1834 - Pages: 8

Premium Essay

Test

...ITT Technical Institute IS3340 Windows Security Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 60 (30 Theory Hours, 30 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisite: NT2580 Introduction to Information Security or equivalent Course Description: This course examines security implementations for a variety of Windows platforms and applications. Areas of study include analysis of the security architecture of Windows systems. Students will identify and examine security risks and apply tools and methods to address security issues in the Windows environment. Windows Security Syllabus Where Does This Course Belong? This course is required for the Bachelor of Science in Information Systems Security program. This program covers the following core areas:    Foundational Courses Technical Courses BSISS Project The following diagram demonstrates how this course fits in the program:    IS4799 NT2799 IS4670 ISC Capstone Project Capstone ProjectCybercrime Forensics NSA    NT2580 NT2670  Introduction to  Information Security IS4680 IS4560 NT2580 NT2670 Email and Web Services Hacking and Introduction to  Security Auditing for Compliance Countermeasures Information Security Email and Web Services      NT1230 NT1330 Client-Server Client-Server  Networking I Networking II  IS3230 IS3350 NT1230 NT1330  Issues Client-Server Client-Server  SecurityContext in Legal Access Security Networking I Networking II   NT1110...

Words: 2305 - Pages: 10

Premium Essay

Nt2640

...associated services. Planning and deployment of network addressing structures, as well as router and switch configurations, are also examined. IP Networking Syllabus Where Does This Course Belong? This course is required in the associate degree program in Network Systems Administration and associate degree in Mobile Communications Technology. The following diagrams indicate how this course relates to other courses in respective programs: Network Systems Administration NT2799 NSA Capstone Project NT2580 Introduction to Information Security NT2670 Email and Web Services NT2640 IP Networking PT2520 Database Concepts NT1330 Client-Server Networking II NT1230 Client-Server Networking I NT1430 Linux Networking PT1420 Introduction to Programming NT1110 Computer Structure and Logic NT1201 Introduction to Networking NT1310 Physical Networking CO2520 Communications SP2750 Group Theories EN1420 Composition II EN1320 Composition I GS1140 Problem Solving Theory GS1145 Strategies for the Technical Professional MA1210 College Mathematics I MA1310 College Mathematics II Networking Technology Courses Programming Technology Courses General Education/ General Studies 1 Date: 7/18/2011 IP Networking Syllabus Mobile Communications Technology MC2799 MCT Capstone Project NT2640 IP Networking MC2560 Mobile Wireless Communication I MC2660 Mobile Wireless Communication II MC2665 Mobile...

Words: 2573 - Pages: 11

Premium Essay

Nothing

...ITT Technical Institute NT1310 Physical Networking Student Course Package Bring this document with you each week Students are required to complete each assignment and lab in this course package on time whether or not they are in class. Late penalties will be assessed for any assignments or labs handed in past the due date. The student is responsible for replacement of the package if lost. Table of Contents Syllabus 2 Student Professional Experience 19 Graded Assignments and Exercises 23 Labs 47 Documenting your Student Professional Experience 57 ITT Technical Institute NT1310 Physical Networking Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisites: NT1210 Introduction to Networking or equivalent Course Description: This course examines industry standards and practices involving the physical components of networking technologies (such as wiring standards and practices, various media and interconnection components), networking devices and their specifications and functions. Students will practice designing physical network solutions based on appropriate capacity planning and implementing various installation, testing and troubleshooting techniques for a computer network. Where Does This Course Belong? | | | NT2799 | | | | | | | | NSA Capstone | | | | | | | Project | | | | | NT2580...

Words: 10839 - Pages: 44