Free Essay

Programming I

In: Computers and Technology

Submitted By coi119
Words 323
Pages 2
Exercise 8: Meadowdale Dairy Farm sells organic brown eggs to local customers. They charge $3.25 for a dozen eggs, or 45 cents for individual eggs that are not part of a dozen. Write a class that prompts a user for the number of eggs in the order and then display the amount owed with a full explanation. For example, typical output might be, “You ordered 27 eggs. That’s 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for a total of $7.85.” Save the class ass Eggs.java

Program Listing import java.util.Scanner;
/**
* Name: Codi Whittaker *ID: UCCI 005272 *Class: Com 200 * coi119@hotmail.com * Group A *Assignment #: 2 *Date due: September 22, 2014 *Date turned in: September 14.2014 * filename: Eggs * Program is working and tested * Write a class that prompts a user for the number of eggs in the order and then display the amount owed with a full explanation. */ public class Eggs { public static void main(String[] args) //Main method { double DE = 3.25; // declaring variables double SE = 0.45; int NO_of_DOZEN = 12; try { Scanner bass = new Scanner(System.in); // creating new scanner device System.out.println("How many eggs do you have: "); //prompting user for amount of eggs bought int eggs = bass.nextInt(); //accepting users input double TOD=(eggs/NO_of_DOZEN)*DE; // calculation for finding how many dozen and singles there are double TOS=(eggs%NO_of_DOZEN)*SE; double T=TOD+TOS; //calculation for the total cost of TOD+TOS System.out.println("You ordered " + eggs + " eggs."); //Printing users original input and the total cost of TOD+TOS System.out.println("Thats " + (eggs / NO_of_DOZEN) + " dozen at $3.35 per dozen and " + (eggs % NO_of_DOZEN) + " loose eggs at 0.45 cents each for a total of: " + T); } catch(Exception e){System.out.println("Error: you must input an interger Number "+e); //Showing user error message because they did not enter the correct information } }
}

Similar Documents

Free Essay

Research Paper on Extreme Programming

...Bibliography 8 Statement of research problem The purpose of this study is to find out if the adoption of Extreme programming in a learning environment has improved student productivity. It is a software development process used by small teams who have rapidly changing requirements. With regard to students, all students that are studying software development modules are also faced with this problem where by the requirements are continuously changing as they get deeper within their project. This paper is to show if extreme programming is actually helping students become more productive regardless of the ever changing requirements. Context or background to the research problem In this day and age the most widely used form of agile development in software development is extreme programming which was proposed by Kent Beck in 1996. Many parameters contribute to the success of XP. Researchers concluded that using XP in an educational domain has many benefits, where they have seen that less skilled students were able to show more progress than they would have if a traditional methodology were used.(Assassa, Mathkour, & Al Dossari). XP offers a number of practices, values and principles which are advised to be adopted in order to run a software development project(Assassa et al., 2006). These values include communication, simplicity, feedback and courage. Extreme programming has four stages which are planning,...

Words: 2047 - Pages: 9

Premium Essay

Informaion System

...Running head: GROUP SOFTWARE DEVELOPMENT Team Programming Environments Information Technology for Teams Course Team Programming Environments Programming teams are achieving advances in deployment of more modular software products through the use of adaptive techniques in software development. Companies implementing large scale enterprise planning and control systems, product data management tools and complex back office systems for global service and support are finding these techniques to be more cost effective, adaptable and lean improving user requests for changing software functionality, processes and improved deployment strategies (Applegate, Austin, & McFarlan, 2002). This paper will compare and contrast three team oriented programming environments including Rational, Unified Modeling and Extreme Programming and will describe the impact of these programming environments on group software development. Literature Review of Software Trends The traditional methods of systems planning and investment decision making in the last century have given pause to leaders who witnessed costs in design, implementation and deployment of software skyrocket, created armies of support teams to operate and manage the software products and forced many firms into bankruptcy. Companies who have successfully implemented enterprise systems are now seeking more adaptive infrastructure deployments, software end-user functional value, and more......

Words: 1921 - Pages: 8

Premium Essay

Multiuse Platforms for Applications

...Programming languages are used to give instructions to a computer to complete a task (Burd 369). Object-oriented programming languages and imperative languages are similar in this way, but go about giving instructions differently. Object-oriented programming languages (OOS), use objects called procedures to manipulate data, in other words these methods are in a predetermined location and wait for a message arrive to execute a specific task (Burd 375). That task could be calculations, changing the color of text or displaying a video. One click on a particular object and the change to data or calculations are completed. Unlike imperative languages, object-oriented languages view data and programs as two parts which comes together to make an object (Burd 375). This makes it easier to maintain and promote reusability (Shelly et al. 250). I can also not fail to mention the object-oriented languages develop interactive user interfaces for real-time programming (Burd 375). This leads me to the integrated development environment (IDE) which consists of tools needed for faster development and testing (Burd 393). Imperative languages like Pascal have to be translated to binary CPU instructions before executing any tasks. They don’t have a graphical user interface like object-oriented programming (Burd 372). Imperative languages also use an interpreter to read source code which take up an enormous amount of resources in memory and CPU requirements while executing programs (Burd......

Words: 659 - Pages: 3

Premium Essay

Programming Timeline

...After researching the programming languages between the eras of 1970s-2000s I discovered there were many types of programming languages being developed at a spectacular rate. The popularity of the languages were dependent upon what you were trying to program. Below you will find a general idea of 5 programming languages and a brief description of those languages. 1970s- PASCAL • Designed in 1968-1969 • Published in 1970 by Niclaus Wirth • Historically influential and procedural programming language • Intended to encourage good programming practices using structured programming and data structuring • Influential imperative and procedural programming language 1980s- C++ (pronounced see plus plus) • Statically typed, free-form, multi-pariadigm, compiled, general-purpose programming language • Middle-level language o Comprises a combination of both high-level and low-level language features • Developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language • Renamed C++ in 1983 • Has imerative, object-oriented, generic programming features • Provides low-level memory manipulation • For use in embedded systems or operating system kernels • Is a compiled language • Available on many platforms and provided by various organizations 1990s- JAVA • Originally developed by James Gosling at Sun Microsystems • Released in 1995 as core component of Sun Microsystems’ Java platform • Derives much of its syntax from C and...

Words: 470 - Pages: 2

Premium Essay

My Penchant For Computer Programming

...I vividly remember the day of my introduction to computer programming, my sixth-grade computer session on 'Logo', an educational programming language. Until that moment, I had assumed computers to be just another source for games and entertainment. It was fascinating to see a machine work on commands given to it by us mortals. It enraptured me so much that I cajoled my father into buying a computer and assaying the various tasks it could accomplish. This, coupled with having a mother who graduated in Mathematics and introduced me to its vast world, sprouted and sharpened my interests in school towards Computers and Mathematics. Furthermore, it was exciting to consider the possibilities of computers solving Mathematical problems at near speed of light and slowly my ambition to become a Computer Engineer took shape....

Words: 1007 - Pages: 5

Free Essay

Programming Solutions

...Programming Solutions Being able to create a solution to a certain problem through programming can be a huge task to undertake, but it is a task that must be accomplished in order to get certain things done. Many companies face problems in the IT field that can be solved through programming, from simple to very complex, these problems usually require some sort of input and variables in order to create a solution. One problem that I face in the workplace of construction, is trying to figure out the number of ceiling tiles we will need to fit the ceilings in most offices we build. The ceiling tiles are a certain size and cover large areas which can be a tedious task trying to count how many tiles it will take to fill in the ceiling. A programming solution could be very beneficial in an instance such as this because by creating inputs such as the size of the tiles and the area they need to cover, an output could be the number of tiles that will be needed and thus saving a large amount of time on counting every space they need to fill. This problem of having to determine the number of ceiling tiles it will take to cover the celling area is normally done by counting the spaces in the ceiling that need to be filled and then determining how many tiles will need to be purchased. By coming up with a program to solve this problem would no doubt save a lot of time and even money by not buying an excess amount and either throwing them away or storing them. I believe a simple program......

Words: 701 - Pages: 3

Free Essay

It Job

...for me are computer programmer, web developer, and software developer. What I am looking to do with a IT degree is to be able to create, so these three career choices are perfect for me. Starting with computer programming, it is actually one of the few areas of IT where we have seen a decrease in jobs. Even though we have seen a decrease in jobs there is still a high demand for them. The median salary being $79,530 with only a bachelor’s degree with a focus of writing and know multiple languages of code. (“Bureau of Labor Statistics, Computer Programming” 2015) My second career choice is being a web developer. I have created a few websites before, along with creating a few logos for family friends, and I have enjoyed the work. So it is only natural for me to be interested in it. Web developers is one of the highest demanding jobs in the IT department, over the past year we have seen a 27% increase in the amount of jobs available. (“Bureau of Labor Statistics, Web Developer” 2015) With the median pay being $64,970 per year and most companies are looking for an associate’s degree, but some will hire without any college education. I like the idea of being a web developer because I combine programming with graphic design. These three careers in IT will continue to be in demand as the world turns more digital with each passing year. As such the salaries will continue to grow as well. Computer programming, Web design, and Software design all have very high job security and are......

Words: 337 - Pages: 2

Free Essay

Computer Info

...Structure and Interpretation of Computer Programs matters In 2011, to celebrate the 150th anniversary of MIT, the Boston Globe made a list of the most important MIT innovations, and they asked me to explain the importance of SICP. This is what I sent them. "Bringing 'No Ceiling' to Scratch: Can One Language Serve Kids and Computer Scientists?" (with Jens Mönig, a talk at the Constructionism 2010 conference in Paris). Scratch is the brilliant grandchild of Logo, from the MIT Media Lab, that uses drag-and-drop visual programming to achieve, truly at last, the "no threshold" half of Logo's famous promise, combined with a half-million-strong social network of kid programmers sharing projects and working collaboratively. But Scratch deliberately drops the "no ceiling" part. How hard would it be to do both at once? Not hard at all, we think, if we remember Lisp's core idea of procedure as data. BYOB (Build Your Own Blocks) is an experimental implementation of this goal. "Speech at UCB CS Graduation, 2005"At Berkeley every department has its own graduation ceremony. At the one for the Computer Science majors in the College of Letters and Science, there are a bunch of student speakers, then a faculty speaker, and then a famous-outsider speaker. This year I gave the faculty speech, about the sorry state of the world. "Harmful to Children? The Alliance for Childhood Report" (a talk at the 2001 EuroLogo conference in Linz). A first pass at a response to Fool's Gold, a report......

Words: 1079 - Pages: 5

Premium Essay

Social Information Technology

...Computer programming (often shortened to programming) is a process that leads from an original formulation of a computing problem to executable computer programs. Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation (commonly referred to as coding[1][2]) of algorithms in a target programming language. Source code is written in one or more programming languages. The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solving a given problem. The process of programming thus often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Related tasks include testing, debugging, and maintaining the source code, implementation of the build system, and management of derived artifacts such as machine code of computer programs. These might be considered part of the programming process, but often the term "software development" is used for this larger process with the term "programming", "implementation", or "coding" reserved for the actual writing of source code. Software engineering combines engineering techniques with software development practices. Computer Programming Principles : Program Design Computer Programming is the process of writing, testing, troubleshooting, debugging and......

Words: 6404 - Pages: 26

Premium Essay

Assignment @ Operation Research

...ASSIGNMENT ON OPERATION RESEARCH ( FIN – 3104 ) 3RD YEAR , 1ST SEMESTER BBA – 3RD BATCH DEPARTMENT OF FINANCE JAGANNATH UNIVERSITY TOPIC Quantitative Analysis for Optimization : Using Linear Programming & Transportation Problem Group Name Name & ID No. of the Group Members: |Sl. No. |Name |ID No. | | | | | |01 |Suman Chandra Mandal (Group Leader) |091557 | | |Md. Nahid Islam |091604 | |02 | | | | | | | |03 |Mahbuba Mehreen |091619 ...

Words: 1940 - Pages: 8

Free Essay

Dantzig

...subject of linear programming might be characterized briefly. It is concerned with the issue of boosting or minimizing a linear capacity whose variables are obliged to fulfill an arrangement of linear stipulations, an obligation being a linear mathematical statement or imbalance. The subject may all the more properly be called linear improvement. Issues of this sort come up in a common and truly rudimentary path in numerous connections however particularly in issues of financial arranging. Linear computer programs are a significant field of enhancement for a few reasons. Numerous pragmatic issues in operations exploration might be communicated as linear programming issues. Certain uncommon instances of linear programming, for example, system stream issues and multicommodity stream issues are viewed as paramount enough to have created much research on specific calculations for their answer, various calculations for different sorts of improvement issues worked by taking care of LP issues as sub-issues. In like manner, linear writing computer programs are intensely utilized as a part of microeconomics and organization administration, for example, arranging, creation, transportation, engineering and different issues. Despite the fact that the present day administration issues are steadily changing, most organizations might want to augment benefits or minimize costs with constrained assets. In this manner, numerous issues could be described as linear programming issues. In......

Words: 1054 - Pages: 5

Free Essay

Factors Affecting Course Outcomes in Introductory Programming

...Outcomes in Introductory Programming Susan Wiedenbeck Drexel University susan.wiedenbeck@cis.drexel.edu Deborah LaBelle Pennsylvania State University-Delaware County dm19@psu.edu Vennila N.R. Kain Media Laboratory Masssachusetts Institute of Technology vennila@vennila.net Keywords: POP-I.B, programmer education, POP-II.A, novices, POP-5.A, mental models, POP-5.A, selfefficacy Abstract Learning to program is difficult for many students. Although several factors that affect learning to program have been identified over the years, we are still far from a full understanding of why some students learn to program easily and quickly while others flounder. Two constructs that may affect learning to program are self-efficacy and mental models. Self-efficacy is the individual’s judgment of his or her ability to perform a task in a specific domain (Bandura 1986). A mental model is a person’s internal (mental) representation of real world objects and systems (Norman 1983). Separate research on self-efficacy and mental models has shown that both are important to knowledge acquisition and transfer. Using a path-analytic approach, this research investigates the joint effects of self-efficacy, mental model, and previous experience on learning to program in an introductory course. The results show that self-efficacy for programming is influenced by previous programming experience, and student self-efficacy increases substantially during an introductory programming course. Furthermore,......

Words: 3199 - Pages: 13

Free Essay

Paper

...PART II: Programming paradigms: procedural, object-oriented, functional, and declarateive This paper is going to briefly discuss programming paradigms: procedural, object-oriented, functional, and declarative. Programming paradigms are ways in which a computer communicates. A programming paradigm is divided into four different languages. The first language is the procedural language. Procedural language is defined as a paradigm in which a program acts on passive objects using procedures. When procedural language is used, the program consists of nothing but a lot of procedure calls. Under the procedural language there are specific languages in which computers fall under. FORTRAN (FORmula TRANslation), COBOL (Common Buisness-Oriented Language), Pascal, C,and Ada. FORTRON was designed by IBM engineers in 1957 and it was the first known high-level language. FORTRAN had high-precision arithmetic, capability of handling complex numbers, and also exponentiation computation (Knox, 2013). COBOL was designed by computer scientists (Forouzan, and Mosharaf, 2008).   COBOL had hast access to files and databases, updated of files and databases, large amounts of generated reports, and user-friendly formatted output. Pascal was invented in 1971 and was designed to teach programming to novices by emphasizing the structured programming approach (Forouzan, and Mosharaf, 2008). The C language was developed in the early 1970s and it had high-level instructions that hides hardware......

Words: 551 - Pages: 3

Free Essay

Software Design

...Module 3 Summary of Key Terms Michael Fouse Embry Riddle University Introduction to Information Systems Management 221 Concetta Manker May 14, 2013 Module 3 Summary of Software Design I began this assignment by searching for the key terms in Google, looking for journal topics that were both informative and interesting to a novice such as me. I have to admit that I was unsuccessful finding an entry that was both, however, I did find an article about software design that was informative (http://www.bleading-edge.com). The article was written by Jack W. Reeves. Jack W. Reeves is a senior software developer with over 30 years’ experience in the industry. He has worked on systems ranging from simulators for the space shuttle, military command and control systems, air traffic control systems, medical imaging systems, financial data distribution systems, embedded systems, drivers, and utilities. He has exclusively been an OO developer for the last 15 years (Jack W. Reeves - About the Author," copyright 2000-2006). In my opinion, the journal article was originally written in 1992 as a call to action to those in the software design and programming vocation. Mr. Reeves was obviously a strong proponent for the use of C++ as the programming language of choice. He compared software design to modern engineering practices in an attempt to better define the process by which software is developed, the need for the software industry to advance and expedite its concept to product......

Words: 591 - Pages: 3

Premium Essay

Cd Key

...Java Quick Reference Console Input Scanner input = new Scanner(System.in); int intValue = input.nextInt(); long longValue = input.nextLong(); double doubleValue = input.nextDouble(); float floatValue = input.nextFloat(); String string = input.next(); Console Output System.out.println(anyValue); JOptionPane.showMessageDialog(null, "Enter input"); GUI Input Dialog String string = JOptionPane.showInputDialog( "Enter input"); int intValue = Integer.parseInt(string); double doubleValue = Double.parseDouble(string); Message Dialog Primitive Data Types byte short int long float double char boolean 8 bits 16 bits 32 bits 64 bits 32 bits 64 bits 16 bits true/false Arithmetic Operators + * / % ++var --var var++ var-addition subtraction multiplication division remainder preincrement predecrement postincrement postdecrement Assignment Operators = += -= *= /= %= assignment addition assignment subtraction assignment multiplication assignment division assignment remainder assignment Relational Operators < >= == != less than less than or equal to greater than greater than or equal to equal to not equal Logical Operators && || ! ^ short circuit AND short circuit OR NOT exclusive OR if Statements if (condition) { statements; } if (condition) { statements; } else { statements; } if (condition1) { statements; } else if (condition2) { statements; } else { statements; } switch Statements switch (intExpression) { case value1: statements; break; ... case valuen: statements;......

Words: 73366 - Pages: 294