Friday, 30 October 2015

COMP 274 Week 4 Programming Assignment ( PERFECT SCORE ) With Screenshots

Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin. The GUI display should look something like the following:
Your program must meet the following requirements:
  1. Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do all the GUI layout work based on what you have learned in class in the last 2 weeks.
  2. The GUI and event handling setup should be done in the constructor of your GUI class or in private methods called from the constructor.
  3. The display must have a label and JTextField where the user inputs a value which must appear in the upperpart of the frame as shown above.
  4. There should be a set of 3 radio buttons which indicate the input scale of the value to be converted. The 3 input scale buttons must be vertically aligned on the left side of the display as shown above.
  5. There should be a set of 3 radio buttons which indicate the output scale to be converted to. The 3 output scale buttons must be vertically aligned and appear on the right side of the display as shown above.
  6.  Event handling must be setup so that selection of any input or output button causes an event which triggers the event handling code to determine which of 9 possible conversions is needed.
  7. Event handling must also respond to the user hitting the enter key in the input textfield! For this event, the event handling code must also determine which conversion is needed based on which buttons are selected.
  8. Display the conversion result in an output text field or in a JLabel which appears in the bottom part of the display as shown above. Output the degree symbol and output scale information as shown above. You can output a degree symbol by putting the character value 176 into a formatted string.
  9. If a radio button is clicked when there is nothing in the input textfield, the event handler must display the string “No Input” in the output textfield.
10.  Your program must accurately convert from Fahrenheit, Celcius, Kelvin to Fahrenheit, Celcius, Kelvin. Only the selected conversion is displayed in the output textfield.
11.  You must create a separate class which does all the temperature conversion calculations. It should have 6 static methods, one for each possible conversion. Each of the 6 methods takes an input temperature and returns the appropriate converted temperature. This class could be used in any other application where temperature conversion is needed. You can find conversion formulas at the following website:
http://en.wikipedia.org/wiki/Temperature_conversion
12.  When the conversion selection changes due to clicking either an input or output scale button, the output area must change to show only the new result.
13.  HINT: For radio button events, use the ItemListener interface and use the isSelected method on the radio buttons to find out which buttons are turned on!
14.  The output must display 2 digits after the decimal point.



Thursday, 29 October 2015

ECO 550 Week 8 DQ1

ECO 550 Week 8 DQ1
"Contracting" Please respond to the following:
From the e-Activity, propose a methodology for assessing the risk in business contracts. Assess the economic impact this methodology may have for the organization. Analyze a situation in which both parties entering into a contract could benefit, economically or otherwise, from slightly ambiguous language contained in the contract. Provide specific examples to support your response.  


ECO 550 Week 1 DQ2

ECO 550 Week 1 DQ2
"Fundamental Economic Concepts" Please respond to the following:
Pick a recently released good or service. Then, determine the factors that must be evaluated regarding the product’s supply and demand. Analyze how these factors impact the decision to supply the product indicating the significance of each in the decision-making process. Using the same product example above, analyzing how the risk tolerance factors play in supplying the good or service and how this should influence management’s decisions


ECO 550 Week 2 DQ2

ECO 550 Week 2 DQ2
"Estimating Demand" Please respond to the following:
Provide an example when it would be appropriate to conduct a time-series or cross sectional data. Discuss the potential problems that may arise with your example and identify strategies for minimizing the impact of the potential problems. Discuss the meaning of the regression coefficient of the independent variable(s) and how it could be used to estimate the elasticities of each of these variables. Discuss how managers use the elasticities measurements to make managerial decisions.



ECO 550 Week 3 DQ2

ECO 550 Week 3 DQ2
"Managing in the Global Economy" Please respond to the following:
Evaluate the relationship between the European Euro crisis in 2012 and the American economy. Assess how this affects American businesses and decisions made by mangers related to sustainable profitability. Provide examples with your response. Aside from maximizing profits, assess the factors that managers must consider when making the decision to outsource or integrate forwards or backwards considering which factor would be most influential for decision-making. 


ECO 550 Week 4 DQ2

ECO 550 Week 4 DQ2
"Cost Analysis" Please respond to the following:
Pick a good or service. Distinguish between the short-run and the long-run production and cost function for that good or service. Discuss how price plays a role in short-run and the long-run decisions and how managers are likely to respond in each case.
Using the same good or service from above. Identify the fixed and variables costs are for the good or service. Based upon the costs identified, recommend whether to produce or not produce the good or service. Provide a rationale with your response 



ECO 550 Week 6 DQ2

ECO 550 Week 6 DQ2
Week 6 DQ2:
"Oligopoly" Please respond to the following:
From the second e-Activity, assess the marketing and pricing strategies, for example rebates, to determine the goal(s) of the marketing and pricing strategies for one of the companies you researched. Make one recommendation for changes that the company should make to better maximize profits. The Internet has made shopping for airline tickets efficient for the consumer. As a result, the industry overall is price sensitive. Suggest how the airlines can maximize profits while avoiding price wars.



ECO 550 Week 7 DQ2

ECO 550 Week 7 DQ2
"Pricing Techniques" Please respond to the following:
From the second e-Activity, propose the new target market segment for the product and its accompanying pricing strategy (for example, bundling and couponing). Provide a rational for why you feel the new target market and pricing strategy would be successful and the likely impact to the profitability of the firm. The pharmaceutical industry often has the luxury of implementing pricing strategies that appear high to consumers. Take a position on the fairness of the industry’s approach to pricing pharmaceutical products including offering an alternative strategy that may be more palatable to consumers. Provide a rationale with your position 



ECO 550 Week 8 DQ1

ECO 550 Week 8 DQ1
"Contracting" Please respond to the following:
From the e-Activity, propose a methodology for assessing the risk in business contracts. Assess the economic impact this methodology may have for the organization. Analyze a situation in which both parties entering into a contract could benefit, economically or otherwise, from slightly ambiguous language contained in the contract. Provide specific examples to support your response.  



ECO 550 Week 5 DQ1

ECO 550 Week 5 DQ1
"Applications of Cost Theory" Please respond to the following:
Imagine you are a manager of a chemical company. An accident has occurred in which chemicals leaked into the ground water nearby, the community is unaware. Assess the costs involved in cleaning up the water immediately (confessing) versus hiding the fact and possibly paying more in the future. Discuss the impact on profitability in both situations. From the first e-Activity, assess the factors involved in conducting a break-even analysis. Determine the conditions that may exist for a manager of this good or service may decide to move forward with operations even with the initial costs of operations is more than the potential revenue.



COMP 274 Week 4 Programming Assignment ( PERFECT SCORE ) With Screenshots

COMP 274 Week 4 Programming Assignment ( PERFECT SCORE ) With Screenshots

Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin. The GUI display should look something like the following:
Your program must meet the following requirements:
  1. Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do all the GUI layout work based on what you have learned in class in the last 2 weeks.
  2. The GUI and event handling setup should be done in the constructor of your GUI class or in private methods called from the constructor.
  3. The display must have a label and JTextField where the user inputs a value which must appear in the upperpart of the frame as shown above.
  4. There should be a set of 3 radio buttons which indicate the input scale of the value to be converted. The 3 input scale buttons must be vertically aligned on the left side of the display as shown above.
  5. There should be a set of 3 radio buttons which indicate the output scale to be converted to. The 3 output scale buttons must be vertically aligned and appear on the right side of the display as shown above.
  6.  Event handling must be setup so that selection of any input or output button causes an event which triggers the event handling code to determine which of 9 possible conversions is needed.
  7. Event handling must also respond to the user hitting the enter key in the input textfield! For this event, the event handling code must also determine which conversion is needed based on which buttons are selected.
  8. Display the conversion result in an output text field or in a JLabel which appears in the bottom part of the display as shown above. Output the degree symbol and output scale information as shown above. You can output a degree symbol by putting the character value 176 into a formatted string.
  9. If a radio button is clicked when there is nothing in the input textfield, the event handler must display the string “No Input” in the output textfield.
10.  Your program must accurately convert from Fahrenheit, Celcius, Kelvin to Fahrenheit, Celcius, Kelvin. Only the selected conversion is displayed in the output textfield.
11.  You must create a separate class which does all the temperature conversion calculations. It should have 6 static methods, one for each possible conversion. Each of the 6 methods takes an input temperature and returns the appropriate converted temperature. This class could be used in any other application where temperature conversion is needed. You can find conversion formulas at the following website:
http://en.wikipedia.org/wiki/Temperature_conversion
12.  When the conversion selection changes due to clicking either an input or output scale button, the output area must change to show only the new result.
13.  HINT: For radio button events, use the ItemListener interface and use the isSelected method on the radio buttons to find out which buttons are turned on!
14.  The output must display 2 digits after the decimal point.


Wednesday, 28 October 2015

ECO 550 All Discussion Questions

ECO 550 All Discussion Questions

Economics - General Economics
ECO 550 All Discussion Questions
ECO 550 Week 1 DQ1
Managerial Economic Decision Making" Please respond to the following:
From the e-Activity, assess how business leaders use managerial economics to make business decisions indicating how profits may be impacted. Analyze the principal-agent problem to determine how the relationship could be less adversarial. Provide support for your rationale. 
ECO 550 Week 1 DQ2
"Fundamental Economic Concepts" Please respond to the following:
Pick a recently released good or service. Then, determine the factors that must be evaluated regarding the product’s supply and demand. Analyze how these factors impact the decision to supply the product indicating the significance of each in the decision-making process. Using the same product example above, analyzing how the risk tolerance factors play in supplying the good or service and how this should influence management’s decisions
ECO 550 Week 2 DQ1
"Demand Analysis" Please respond to the following:
From the e-Activity, if you were a manager in a tobacco company, analyze the elasticity of demand for tobacco products. Evaluate the factors involved in making decisions about pricing tobacco products indicating which would be the most influential.  Using the same scenario above, discuss how the elasticity influence the short-term and long-term decisions of the company and the impact to the decision made related to profitability. 
ECO 550 Week 2 DQ2
"Estimating Demand" Please respond to the following:
Provide an example when it would be appropriate to conduct a time-series or cross sectional data. Discuss the potential problems that may arise with your example and identify strategies for minimizing the impact of the potential problems. Discuss the meaning of the regression coefficient of the independent variable(s) and how it could be used to estimate the elasticities of each of these variables. Discuss how managers use the elasticities measurements to make managerial decisions.
ECO 550 Week 3 DQ1
"Business and Economic Forecasting" Please respond to the following: • From the e-Activity, develop a regression equation using the data you collected from your research. Use the regression equation to focus the demand for the product you chose for the next three periods. Assess what the results of the regression equation tells managers and how it is likely to impact decisions made related to maximizing profitability. • Imagine you are a manager for the good or service used above. From the results of the regression equation, suggest strategies to either maintain demand (if an increase over three periods occurs) or improve demand (if a decrease over three periods occurs). Provide support for your recommendations 
ECO 550 Week 3 DQ2
"Managing in the Global Economy" Please respond to the following:
Evaluate the relationship between the European Euro crisis in 2012 and the American economy. Assess how this affects American businesses and decisions made by mangers related to sustainable profitability. Provide examples with your response. Aside from maximizing profits, assess the factors that managers must consider when making the decision to outsource or integrate forwards or backwards considering which factor would be most influential for decision-making. 
ECO 550 Week 4 DQ1
"Production Economics" Please respond to the following:
From the e-Activity, determine the environmental variable most likely to affect the short-run production over the next 12 months. Determine what managers can do to prepare for the possible change in short-run production. Pick a real or fictitious business. Create a scenario around this business in which a manager would decide to either stop operations in the short-run or going out of business in the long-run. Provide a rationale with your response 
ECO 550 Week 4 DQ2
General Questions - General General Questions
"Cost Analysis" Please respond to the following:
Pick a good or service. Distinguish between the short-run and the long-run production and cost function for that good or service. Discuss how price plays a role in short-run and the long-run decisions and how managers are likely to respond in each case.
Using the same good or service from above. Identify the fixed and variables costs are for the good or service. Based upon the costs identified, recommend whether to produce or not produce the good or service. Provide a rationale with your response 
ECO 550 Week 5 DQ1
"Applications of Cost Theory" Please respond to the following:
Imagine you are a manager of a chemical company. An accident has occurred in which chemicals leaked into the ground water nearby, the community is unaware. Assess the costs involved in cleaning up the water immediately (confessing) versus hiding the fact and possibly paying more in the future. Discuss the impact on profitability in both situations. From the first e-Activity, assess the factors involved in conducting a break-even analysis. Determine the conditions that may exist for a manager of this good or service may decide to move forward with operations even with the initial costs of operations is more than the potential revenue 
ECO 550 Week 5 DQ2
"Prices, Output and Strategy" Please respond to the following:
Pick a good or service you are familiar. Speculate how the price for that good or service may have been set and how well this price maximizes profit for the company and determine what shifts the company should made in its pricing strategy.  Provide support for your recommendations. From the second e-Activity, discuss how the company you selected should increase its competitive stance in the marketplace and how management would implement the recommendations. Provide specific examples to support your response
ECO 550 Week 6 DQ1
WEEK 6 DQ1
"Monopolies" Please respond to the following:
From the first e-Activity, imagine this company acting as a monopoly was to have a new competitor arrive in the marketplace. Assess how the monopoly would likely change its pricing strategy to compensate for the new competition.
From the first e-Activity, speculate how the monopolist could be more efficient in the long-run considering new competition has entered the marketplace
ECO 550 Week 6 DQ2
Week 6 DQ2:
"Oligopoly" Please respond to the following:
From the second e-Activity, assess the marketing and pricing strategies, for example rebates, to determine the goal(s) of the marketing and pricing strategies for one of the companies you researched. Make one recommendation for changes that the company should make to better maximize profits. The Internet has made shopping for airline tickets efficient for the consumer. As a result, the industry overall is price sensitive. Suggest how the airlines can maximize profits while avoiding price wars. 
ECO 550 Week 7 DQ1
"Game Theory"
Please respond to the following: • Demand for airline tickets fluctuates throughout the year, which affects the price of an airline ticket. Suggest the type of game that may be most appropriate for a specific airline to play to address the differences in demand and elasticity and the resulting impact on profitability. Provide support for your reply. • From the first e-Activity, propose a short-term and long-term pricing strategy for the product or service you researched including how the strategies would be implemented. Assess how your proposal ultimately maximizes profits 
ECO 550 Week 7 DQ2
"Pricing Techniques" Please respond to the following:
From the second e-Activity, propose the new target market segment for the product and its accompanying pricing strategy (for example, bundling and couponing). Provide a rational for why you feel the new target market and pricing strategy would be successful and the likely impact to the profitability of the firm. The pharmaceutical industry often has the luxury of implementing pricing strategies that appear high to consumers. Take a position on the fairness of the industry’s approach to pricing pharmaceutical products including offering an alternative strategy that may be more palatable to consumers. Provide a rationale with your position 
ECO 550 Week 8 DQ1
"Contracting" Please respond to the following:
From the e-Activity, propose a methodology for assessing the risk in business contracts. Assess the economic impact this methodology may have for the organization. Analyze a situation in which both parties entering into a contract could benefit, economically or otherwise, from slightly ambiguous language contained in the contract. Provide specific examples to support your response.  
ECO 550 Week 8 DQ2
"Organization Form" Please respond to the following:
Analyze the potential downfalls of any team effort and make at least one recommendation for minimizing risk. Provide specific examples to support your response. Evaluate the organization form that would be most efficient in minimizing the principal-agent problem. Provide a rationale with your response 
ECO 550 Week 9 DQ1
"Government Regulation" Please respond to the following:
From the e-Activity, take a position on whether more government regulation is needed in the banking industry. Support your position with evidence or examples. Provide an example of how government regulation is either constraining or enabling for a particular company indicating the impact to the operational efficiency of the company. Discuss how your response impacts maximizing shareholder wealth 
ECO 550 Week 9 DQ2
"Antitrust and Licensing" Please respond to the following:
Imagine how managerial decisions may be easier or more difficult if there were no antitrust restrictions in the U.S. Provide an example to support your response. The IT industry is full of patents. There are some companies, referred to as patent trolls, whom purchase these patents in hopes of making money by enforcing patents against alleged infringers. Determine the impact of government regulation against patent trolls. Identify who wins and who loses if regulation was adopted 
ECO 550 Week 10 DQ1
"Capital Investments" Please respond to the following:
With the current U.S. economy in a weakened state, many companies are reluctant to implement any capital improvements or capital expenditures in fear of the economic uncertainty that exists that may negatively impact the cashflow of the organization. Assess the impact of this behavior on productivity, cost efficiency, diversification of assets, or impact to future cashflows that may emerge if companies continue this mindset indicating the long-term risk to profitability. Provide an example or scenario to support your response. Analyze the challenges that companies face in entering global markets. Identify the potential impact to capital budgets in making the decision to move into a global market 
ECO 550 Week 10 DQ2
"Cost-Benefit Analysis" Please respond to the following:
Provide a cost-benefit analysis for a company which has to decide whether to hire more staff or hire temporary workers to meet production.schedules. Determine how managers would use your cost-benefit analysis to make this decision. Conduct a cost-benefit analysis of obtaining a graduate degree. Assess both the short-term and the long-term costs and benefits to determine why some people obtain the extra education while others do not




Click to get the answer!!

POS/355 Week 3 ALL DISCUSSION QUESTIONS

POS/355 Week 3 ALL DISCUSSION QUESTIONS




Click to get the answer!!

PRG 421 Version 10 ( ORIGINAL WORK )

PRG 421 Version 10 ( ORIGINAL WORK )
PRG/421 V10
PRG-421 Java Programming II
WEEK 1
Write a 200- to 300-word short-answer response for the following:

  • What is an event? How are events and graphical user interfaces (GUIs) related? Provide an example of an event and relate it to a GUI.

Write a 200- to 300-word short-answer response for the following:

  • How are containers used in the Java® language? Write a small program in which you add components to a container. Then post the code for your program.

Write a 200- to 300-word short-answer response for the following:

  • What do you feel are the advantages and disadvantages to using Swing versus AWT?

A city is sponsoring a run to support local charities and would like an application to track the pledges. The result will be a database that holds data on individuals, total pledges obtained, and the charity for which the donation is designated.

Design and implement a GUI-based program to accept a participant’s name, the amount pledged, and the designated charity’s name. The program will store these data for later retrieval. The project will be completed in several stages, with the first deliverable due in Week Two.
Design, implement, test, and debug a GUI-based version of a “Hello, World!” program.
Create a JFrame that includes a JLabel that reads “Hello, World!” Use a layout manager of your choice.
Include an Exit button to close the program.
Submit assignment per the APA template that will be provided, to include cover page, description of code, flowchart or pseudocode, code with header data, and finally a screen shot of your code executing on your computer.  Please submit your assignment as YourLastNameWk1.doc and YourLastNameWk1.java.  Ensure that your code executes prior to submittal. 


WEEK 2
Write a 200- to 300-word short-answer response for the following:

  • How do arrays and combo boxes work together? Write a small program in which you add the elements of an array to a combo box and post the code for your program.
Write a 200- to 300-word short-answer response for the following:

  • What are advantages of using menus in a GUI application? Design a menu structure for a program you would find useful in your work or hobbies. Write and post the code for the menu creation.

Develop a project plan for the fundraiser program due in Week Five.

  • The project plan should describe the design of the program and how it is to be modularized. The design should include the layout of the GUI.

    Note. The program should be designed in a modular way so that individual team members can write the code for specific methods.
  • The project plan should also include individual task assignments.

Submit the project plan to your facilitator.
For this assignment, you will choose from the following options:

  • Option 1: Retail Calculator
  • Option 2: Payroll Application

Read the instructions in the University of Phoenix Material: GUI Components Program located on the student website and select one option to complete the assignment.

Submit assignment per the APA template that will be provided, to include cover page, description of code, flowchart or pseudocode, code with header data, and finally a screen shot of your code executing on your computer.  Please submit your assignment as YourLastNameWk2.doc and YourLastNameWk2.java.  Ensure that your code executes prior to submittal.


WEEK 3
Write a 200- to 300-word short-answer response for the following:

  • Think of a programming task—other than the individual or team assignments in this course—in which you would choose to use an exception handler. Write the code for the try-catch block. Explain the activity and your code.

Write a 200- to 300-word short-answer response for the following:

  • Think of a programming task—other than the individual or team assignments in this course—in which you would choose to use a data file. Write the code to read or write the file. Explain the activity and your code.

Write a 200- to 300-word short-answer response for the following:

  • What are the advantages and disadvantages of sequential and random access files?
  • Provide an example in which a sequential file is a better choice than a random access file. Explain why.
  • Provide an example in which a random access file is better than a sequential file. Explain why.

Create a GUI-based program to accept name of donor, name of charity, and amount of pledge from the user.
Display a list of entries in a JTextArea or JTable.
Submit the .java source file for this program.
This is a two-part assignment.

Part 1

Design, implement, test, and debug a program with a JFrame that allows the user to enter a series of contacts’ names, ages, e-mail addresses, and cell phone numbers, and creates a file from the entered data. Validate the age entry to ensure that it is numeric and between 0 and 120. Include information for three to five contacts.

Part 2

Design, implement, test, and debug a program that reads the file you created by the list in Part 1 and displays the records in a JFrame. You may either display all entries in the list at once or display them one at a time; the user interface is up to you. Protect against not being able to open the file.

Submit assignment per the APA template that will be provided, to include cover page, description of code, flowchart or pseudocode, code with header data, and finally a screen shot of your code executing on your computer.  Please submit your assignment as YourLastNameWk3.doc and YourLastNameWk3.java.  Ensure that your code executes prior to submittal.


WEEK 4
Write a 200- to 300-word short-answer response for the following:

  • What are three ways Java® applets enhance network security? Describe how each is used and how it affects security.

Write a 200- to 300-word short-answer response for the following:

  • How would you differentiate a website that uses a Java® applet from one that uses JavaScript® code? Locate a website that includes a Java® applet and provide its URL.
  • Describe each user interface component used and how the applet uses each of them.
  • Do you think the applet uses interface components effectively? Why or why not?.
Write an applet that includes a pie chart.

Use a news article with statistics that are good candidates for a pie chart: for example, political candidate preferences; percentages of those for, against, or undecided about a ballot measure; and so forth.

Cite the source for your input statistics.

Submit the applet along with an HTML file to launch it. Submit assignment per the APA template that will be provided, to include cover page, description of code, flowchart or pseudocode, code with header data, and finally a screen shot of your code executing on your computer.  Please submit your assignment as YourLastNameWk4.doc, YourLastNameWk4.html andYourLastNameWk4.java.  Ensure that your code executes prior to submittal.


WEEK 5
Conduct an Internet search for JavaDB tutorial. You may choose to use either a text-based or a video tutorial. Follow the steps in the tutorial to learn how to use JavaDB.

Modify one of the demo programs with the JavaDB download to create and manipulate your own database.

Write a 200- to 300-word description of the challenges you encountered.

Post the source code of your program.

Write a 200- to 300-word short-answer response for the following:

  • What type of mobile app would you find useful? What steps would you take to create and deploy this app?
Write a program to create a database from the data in the sequential file you created in Week Four.

Modify the GUI to connect to this database and add entries to it and read entries from it. Entries read from the database should be displayed in the JTextArea or JTable.

Test and debug this final program.

Submit the .java source file or files.


Sunday, 25 October 2015

CIS/115 iLab 5 of 7

CIS/115 iLab 5 of 7


Scenario:
Your algorithm will keep track of a customer’s purchases at the local fireworks stand. Customers will not know exactly how many items they will purchase, so using a FOR loop on this lab is not allowed. Let’s keep the rules simple.
1) Accept the dollar value of each item purchased from the user until the user is finished.
2) When purchases are complete, enter a sentinel value of -1 (indicating the user has finished).
3) If more the item purchased is 50.00 or more, give your customer a 10% discount on their item purchased.
4) Display all of the purchases to the customer with the original price and the discount price.
Be sure to THINK about the logic and design first (IPO chart and pseudocode), then code the Visual Logic command line processing.

Lab Steps:
Preparation:
1. Complete the IPO Model in a Word document.
2. Complete the pseudocode in the same Word document as the IPO.
3. Complete the flowchart in Visual Logic and print screen the flowchart in the same Word document as the IPO and pseudocode.
4. Complete the execution/run of the flowchart and print screen your outputs in the same Word document as the IPO, pseudocode and flowchart.

CIS/115 iLab 4 of 7

You have been asked to design a program that will allow a teacher to calculate the percentage and the final grade for students in a class. The program will prompt the teacher to enter the student’s first and last name and the number of points the student received. The program shall only accept scores between 0 and 1,000 points (including 0 and 1,000), with 1,000 points being the maximum number of points. If the input value is within the valid range, the program will display a "good score" message; otherwise, the program will display an error message and then terminate the program. The program shall then calculate the score percentage, and then determine the grade based on the percentage using the following grade criteria:


Score Percent RangeGrade 
90-100A
80-89B
70-79C
60-69D
0-59F

The program will then display the student’s first name, last name, number of points, calculated percentage, and the final grade.

The program shall have an initial prompt informing the user of the program's purpose, and a program termination message.

CIS/115 iLab 4 of 7

You have been asked to design a program that will allow a teacher to calculate the percentage and the final grade for students in a class. The program will prompt the teacher to enter the student’s first and last name and the number of points the student received. The program shall only accept scores between 0 and 1,000 points (including 0 and 1,000), with 1,000 points being the maximum number of points. If the input value is within the valid range, the program will display a "good score" message; otherwise, the program will display an error message and then terminate the program. The program shall then calculate the score percentage, and then determine the grade based on the percentage using the following grade criteria:


Score Percent RangeGrade 
90-100A
80-89B
70-79C
60-69D
0-59F

The program will then display the student’s first name, last name, number of points, calculated percentage, and the final grade.

The program shall have an initial prompt informing the user of the program's purpose, and a program termination message.

CIS/115 iLab 6 of 7 (PERFECT SCORE)

CIS/115 iLab 6 of 7


SCENARIO 
Your algorithm will keep track of a customer’s purchases at the local fireworks stand. Customers will not know exactly how many items they will purchase, so using a for-loop on this lab is not allowed. Let’s keep the rules simple.
Accept the dollar value of each item purchased from the user until the user is finished.
When purchases are complete, enter a sentinel value of -1 (Make certain you do not include the -1 sentinel value in your total).
Keep track of the total dollar amount of all fireworks purchased.
Keep a tally of the number of items purchased.
If more than 20 items were purchased, give your customer a 10% discount on the total purchases. 
Once purchases are complete, display the total number of items purchased, the average price of the items, the total of all fireworks purchased, any discount if applicable, and the total of all fireworks purchased minus the discount.
Be sure to THINK about the logic and design first (IPO chart and/or pseudocode), then code the Visual Logic command line processing.

Deliverables
IPO Chart
Pseudocode
Flowchart
Output screenshots


CIS/115 iLab 2 of 7

CIS/115 iLab 2 of 7

Your goal is to solve the following simple programming exercise. You have been contracted by a local antique store to design an algorithm determining the total purchases and sales tax. According to the store owner, the user will need to see the subtotal, the sales tax amount, and the total purchase amount. A customer is purchasing four items from the antique store. Design an algorithm where the user will enter the price of each of the four items. The algorithm will determine the subtotal, the sales tax, and the total purchase amount. Assume the sales tax is 7%.
 
Be sure to THINK about the logic and design first (IPO chart and pseudocode), then code the Visual Logic command line processing. Display all output using currency formatting (built-in Visual Logic function).
 
Advanced (optional):  Use a constant for the 7% sales tax.
 
Deliverables
Total Purchases IPO Model
Total Purchases Pseudocode
Total Purchases Flowchart
Total Purchases Output Sample




Friday, 23 October 2015

COMP 274 Week 5 Programming Assignment with Screenshots

Timer and Mouse Events and Java Graphics
Introduction
The purpose of this week’s programming assignment is to learn how to deal with events from multiple sources. In addition, we will learn how to use some of Java’s graphics capabilities for drawing shapes in a display area. The programming assignment for this week is to implement a simple paddle ball game.

Paddle Ball Game Overview
The paddle ball game is a simplification of the Pong game. In the Pong game, a ball is moving around the display, bouncing off walls. The player moves a paddle in one dimension, trying to hit the ball whenever possible. If the ball hits the paddle, it bounces off and continues on its way. If the paddle misses the ball, the ball goes off the end of the display area and the player loses a point.
In our paddle ball game, the ball moves around the display, bouncing off walls just as in the Pong game. The player controls a paddle trying to hit the ball just like in the Pong game. If the ball hits the paddle, it bounces off and continues on its way. The main difference in our game is that if the player misses the ball, the ball simply bounces off the wall behind the paddle and continues to travel. There is no scoring in this game.

Object Oriented Design
If we analyze the game description we can see there are several different objects which are interacting. There is a ball object which is traveling around the display. There is a paddle object which is being moved by the player. There is a display which is presenting the graphical representation of the game to the user. These objects are readily apparent from the description of the game.
The ball object has a size and a position within the field of play. It also has a direction of travel in both the X and Y dimensions. The ball must be able to update its position when needed. Since the ball normally bounces off walls, it needs to know the length and width of the field of play when updating its position.The ball must also be able to draw itself.
The paddle has a size and a position within the field of play. The paddle must be able to update its position within the field of play. The paddle must also be able to draw itself.
The display has a display area which has a length and width. It has a means for drawing graphical shapes within the display area. The display area must be able to update the display area the position of the ball or paddlechanges. The display itself has no concept of the game or its objects, so it will need to interact with some other object to draw all the game objects.
At this point, we have a ball, a paddle, and a display object. What is missing is some object which provides the game context. The ball has no awareness of the paddle. The paddle has no awareness of the ball. The display has no awareness of either the ball or paddle. We need an object which enforces the rules and concepts of the game and manages the behaviors of the other objects involved in the game.
Let’s call this the controller object. The controller has a ball, a paddle, and a display object. The controller manages game events. It gets mouse events and tells the paddle to update its position based on the position of the mouse cursor. It gets timer events and tells the ball to update its position based on the size of the display area which it gets from the display. It tells the display when to redraw the display area. It also provides a method which the display object uses to request the controller to draw the current state of the game. The controller is responsible for telling the ball and paddle to draw themselves.
The controller is also responsible for detecting when game objects are interacting. Specifically, it must be able to determine when the ball has made contact with the paddle. This requires that the controller is able to determine if a specific surface of the ball is in contact with a specific surface of the paddle. When this is detected, the controller tells the ball to reverse the direction of travel in the X or Y direction. This places a requirement on the ball and paddle to provide methods allowing the controller to determine the X or Y position of any given surface of the ball or paddle.

The Ball Class
Given that the ball has a size, a position, and moves a specific amount on each update, the Ball class will need member variables for all of these attributes. The size of the ball (diameter) and the number of pixels to move per update should be established when a ball object is created (explicit value constructor). To simplify things, the distance to move (increment) will initially be the same in the X and Y directions. The X and Y position members need to be set to some starting position by the constructor. The X, Y position of the ball is the upper left corner of the minimal box which contains the ball.
When the X increment is positive, the ball is traveling to the right. When it is negative it is traveling to the left. When the Y increment is positive the ball is traveling down. When it is negative it is traveling up.
According to the description in the previous section, the ball must provide the position of  its edges to the controller. To do that, the Ball class provides the following methods:
getTop, getBottom, getLeft, getRight
The first two methods return the Y coordinate of the top/bottom edge of the ball. The other two methods return the X coordinate of the left/right edge of the ball. These values can easily be calculated from the X, Y position and the diameter of the ball.The Ball class must provide a method which takes a Graphics object parameter and uses it to draw the ball at its current position.
When the controller detects that the ball has hit the paddle, the controller must tell the ball to reverse its direction of travel in either the X or Y direction. To be flexible, the Ball class should provide two methods, one to reverse the X direction and one to reverse the Y direction. To the ball, reversing direction simply means negating the value of the X or Y increment.
The controller also must know whether the center of the ball is within the boundaries of the paddle in order to detect contact. This means the Ball class must provide methods to report its horizontal or vertical center. This can be easily computed from the current position and the diameter.
Finally, the Ball class providesa method which the controller calls any time the ball needs to change position. This method adds the X increment to the current X position, and the Y increment to the current Y position. The Ball class is responsible for detecting when it has encountered a wall. So, this method needs to know where the edges of the game area are. This method must be given the length and height of the game area as parameters. The following conditions must be checked for detectingcontactwith a wall:
1.      Top edge of ball <= 0 then reverse Y travel direction
2.      Bottom edge of ball >= height then reverse Y travel direction
3.      Left edge of ball <= 0 then reverse X travel direction
4.      Right edge of ball >= length then reverse X travel direction

The Paddle Class
The Paddle class has a length and a position. Both of these should be initialized by an explicit value constructor. That allows the controller to determine the paddle length and the position of the paddle relative to the wall. We will simplify things by stating that the paddle will have a horizontal orientation and will move left to right only. The paddle cannot move in the vertical direction once it has been created. The X and Y position of the paddle should represent the center of the top surface of the paddle. This will support the correlation of the mouse cursor position to the center of the paddle.
The draw method of the Paddle class takes a Graphics object parameter and draws a filled rectangle based on the current position of the paddle.Drawing a rectangle is based on the upper left corner of the rectangle as its reference position. Calculation of the reference position is easily done using the X and Y position of the paddle and the length of the paddle. The Paddle class controls what the width of the paddle will be.
To support the controller, the Paddle class must have methods which return the position of the top, bottom, left, and right edges of the paddle. The controller needs this information for detecting when the ball and paddle come into contact. The getTop and getBottom methods return a Y position. The getLeft and getRight methods return an X position. These values are easily calculated from the X and Y postion, and the length and width of the paddle.
Finally, a method must be provided to allow the controller to change the position of the paddle based on the X and Y coordinates of the mouse cursor. This method must restrict the movement of the paddle to changes to the X coordinate only.

The Display Class
The Display class provides a window to present the visual rendering of the state of the game. It also must interact with the controller. The easiest way to create a Display class which can draw various graphics is to have the class extend the JPanel class and override the paintComponent method. This method should simply fill a rectangle with some background color. The size of the rectangle is simply the size of the panel which isacquired from the getWidth and getHeight methods of the JPanel class. After drawing the background, the display object must pass its Graphics object to the controller, enabling the controller to arrange for the other game components to draw themselves.
The only other method needed in this class is an explicit value constructor which takes a controller object and stores it into a member variable. The constructor also creates a JFrame object storing it into a member variable. The display object adds itself to the JFrame. The frame initialization should be completed, including setting the initial size of the window which will display the game.
The Controller Class
The controller manages all aspects of the game including various game parameters. It determines the diameter of the ball and the distance the ball travels with each move. The distance travelled should be less than the diameter. The speed of ball movement is controlled by a combination of distance travelled and frequency of timer events. Timer events should be set up to occur around every 25 milliseconds. The length of the paddle should be at least twice the diameter of the ball. The game is to be set up so the paddle moves horizontally near the top of the display area. There should be at least 5% of the display height between the paddle and the top of the display area.
The Controller class contains a ball object, a paddle object, and a display object. In addition, the controller is responsible for managing the events that drive the game. Therefore, this class must implement the ActionListener interface to deal with Timer events which drive the ball.It must also implement the MouseMotionListener interface to cause the paddle to move based on mouse movement.
The constructor of this class creates the three objects mentioned above. It also must create a Timer object which will fire every 25 milliseconds and send ActionEvents to the controller object’s actionPerformed method. The last thing the constructor needs to do is to register the controller object as a mouseMotionListener on the display object. So, when the mouse cursor moves across the display area, MouseEvents will be delivered to the mouseDragged or mouseMoved methods of the controller object.
The controller provides a draw method which takes a Graphics object parameter and is called by the display object. This method should check to see if the ball and paddle objects exist, and if they do, ask each object to draw itself, passing the Graphics object into the draw methods of those objects.
The mouseDragged and mouseMoved methods are responsible for managing the padddle position. When a MouseEvent occurs and one of these methods executes, the method usesitsMouseEventparameter to get the current X and Y coordinates of the mouse cursor. These coordinates are given to the update method of the paddle which adjusts the paddle position based on these new coordinates. Once the paddle has been updated, the controller calls the repaint method on the display object to cause the display to reflect the new position of the paddle.

COMP 274 Week 4 Programming Assignment With Screenshots

Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin. The GUI display should look something like the following:
Your program must meet the following requirements:
  1. Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do all the GUI layout work based on what you have learned in class in the last 2 weeks.
  2. The GUI and event handling setup should be done in the constructor of your GUI class or in private methods called from the constructor.
  3. The display must have a label and JTextField where the user inputs a value which must appear in the upperpart of the frame as shown above.
  4. There should be a set of 3 radio buttons which indicate the input scale of the value to be converted. The 3 input scale buttons must be vertically aligned on the left side of the display as shown above.
  5. There should be a set of 3 radio buttons which indicate the output scale to be converted to. The 3 output scale buttons must be vertically aligned and appear on the right side of the display as shown above.
  6.  Event handling must be setup so that selection of any input or output button causes an event which triggers the event handling code to determine which of 9 possible conversions is needed.
  7. Event handling must also respond to the user hitting the enter key in the input textfield! For this event, the event handling code must also determine which conversion is needed based on which buttons are selected.
  8. Display the conversion result in an output text field or in a JLabel which appears in the bottom part of the display as shown above. Output the degree symbol and output scale information as shown above. You can output a degree symbol by putting the character value 176 into a formatted string.
  9. If a radio button is clicked when there is nothing in the input textfield, the event handler must display the string “No Input” in the output textfield.
10.  Your program must accurately convert from Fahrenheit, Celcius, Kelvin to Fahrenheit, Celcius, Kelvin. Only the selected conversion is displayed in the output textfield.
11.  You must create a separate class which does all the temperature conversion calculations. It should have 6 static methods, one for each possible conversion. Each of the 6 methods takes an input temperature and returns the appropriate converted temperature. This class could be used in any other application where temperature conversion is needed. You can find conversion formulas at the following website:
http://en.wikipedia.org/wiki/Temperature_conversion
12.  When the conversion selection changes due to clicking either an input or output scale button, the output area must change to show only the new result.
13.  HINT: For radio button events, use the ItemListener interface and use the isSelected method on the radio buttons to find out which buttons are turned on!
14.  The output must display 2 digits after the decimal point.