Saturday, January 25, 2020

Object oriented programming with subclasses

Object oriented programming with subclasses Inheritance Polymorphism Given Person class definition below: class Person { private String name; Person(String name) { this.name = name; } public String getName() { return name; } } Design two subclasses of Person, named Student and Employee. Make Faculty and Staff subclasses of Employee. An instance of Student has a class status (freshman, sophomore, junior, and senior). Declare the status as constants in the Student class. An instance of Employee has a department, salary, and date-hired. Define a class named MyDate that contains fields of the year, month, and day. A faculty member has office hours and a rank (lecturer, senior lecturer, associate professor, and professor). A staff member has a position title. Override the toString() method in Person class to display the class name and the persons name. Student class to display class name, students name and class status. Employee class to display class name, employees name, and department Faculty class to display class name, employees name, office hours and rank Staff class to display class name, employees name, position title Draw a class diagram to represent the relationship of the classes above. Using Java to write and implement the classes with regard to the class diagram. Write a test program in Java that creates instances of Person, Student, Employee, Faculty, and Staff, and invokes their toString() method. Write another test program in Java that creates instances of Person, Student, Employee, Faculty, and Staff in an array of Object. Use a repetition statement to call its toString() method. Modify the classes in question (1) above: Add a package ctb2209.p7 to Person class, and then compile all the classes again. Explain the errors and fix it. Design a class named Square that contains data fields for height, width, and an abstract method named computeSurfaceArea(). Create a child class named Cube. Cube contains an additional data field named depth, and overrides computeSurfaceArea() method inherited from its parent method. Implement all the classes. Write an application that instantiates objects of Square and Cube in an array and displays the surface areas of each object using iteration, and test all the methods of all the objects. Create an abstract AutoMobile class with fields for the car make and price. Include get and set methods for these fields; the calculatePrice() method is abstract. Create two subclasses for individual automobile makers (for example, Ford or Honda), and include appropriate calculatePrice() method in each subclass (for example, RM110,000 or RM120,000 respectively). Finally, write an application that uses the AutoMobile class as reference type and instantiate objects of its subclasses to display information about different cars. Save the files as AutoMobile.java, Ford.java, Honda.java and UseAutoMobile.java. Create an interface called Player. The interface has an abstract method called play() that displays a message describing the meaning of play to the class. Create classes called Child, Musician, and Actor that implement Player interface. Create an application that demonstrates the use of the classes. Save the files as Player.java, Child.java, Actor.java, Musician.java, and UsePlayer.java. Sunway Construction Loan Corporate makes loans of up to RM100,000,000,000 for construction projects. There are two categories of Loans those to businesses and those to individual applicants. Write an application that tracks all new construction loans. The application must also calculate the total amount owed at the due date (original loan amount + loan fee). The application should include the following classes: LoanConstants A public interface class. LoanConstants includes constant values for short-term (one year), medium-term (three years), and long-term (five years) loans. It also contains constants for the company name and the maximum loan amount. Loan A public abstract class that implements the LoanConstants interface. A Loan includes a loan number, customer last name, amount of loan, interest rate, and term. The constructor requires data for each of the fields except interest rate. Do not allow loan amounts over RM100,000,000,000. Force any loan term that is not one of the three defined in the LoanConstants class to a short-term (one-year) loan. Create a toString() method that displays all the loan data. BusinessLoan A public class that extends Loan. The BusinessLoan constructor sets the interest rate to 1% over the current basic interest rate. PersonalLoan A public class that extends Loan. The PersonalLoan constructor sets the interest rate to 2% over the current basic interest rate. CreateLoans An application that creates an array of five Loans. Prompt that user for the current basic interest rate. Then, in a loop, prompt the user for a loan type and all relevant information for that loan. Store the created Loan objects in the array. When data entry is complete, display all the loans. Save the files as Loan.java, LoanConstants.java, BusinessLoan.java, PersonalLoan.java, and CreateLoans.java. [Note: java.util.Date and java.text.SimpleDateFormat may needed for your total amount owed at the due date calculation, you may look at the usage of format() and parse() methods of SimplateDateFormat class]

Friday, January 17, 2020

Advantages and Disadvantages of Using Multimedia to Enhance Web Sites Cookies & Spyware

Developing websites not only require the knowledge and skills in setting it up in the World Wide Web, but also implementing some elements that help in realizing the purpose of the website, making it attractive and interactive. This aim may be achieved by utilizing multimedia tools and applications in developing the website. Educational website count on multimedia to motivate online users to learn, gaming websites rely on animations for appeal and entertainment, and radio shows available online depend on the quality of audio streaming.Although utilizing multimedia seems to be the most effective way to improve the dynamics of a website to realize its purpose and objectives, it still holds disadvantages both for web site developers, owners, and users. A multimedia website is a dynamic website that utilizes various media of communication and information exchange such as audio and video materials, audio-visual elements, and animations. The objective of injecting multimedia to websites is to improve services and increase its viewers by initially attracting them and keeping them engaged or involved through pure entertainment.It attracts wider populations of online users because it appeals to audio, visual, audio-visual, and kinesthetically motivated individuals. Since multimedia websites are visually attractive overall, first-time visitors become interested and are instantly involved with the elements of the website. (Multimedia Websites, 2005) Aside from these advantages, multimedia websites also allow faster and easier access to larger populations. Access to multimedia websites is not limited to a particular number of online users. Moreover, the content of websites is easily modified when multimedia elements are used.(Advantages and Disadvantages of Different Types of Teaching Media that can be used in a Teleclassroom or on the Web, 2008)The disadvantage of multimedia websites lies in its planning, production, and maintenance stages. Establishing multimedia websites are costly and time-consuming. Website developers who utilize multimedia often require longer periods of time for preparation and development, while setting up multimedia websites require adequate amounts of resources. Maintenance is also key in making sure that the website functions efficiently at all times.However, website owners cannot maintain multimedia websites on their own. They need to require the services of website developers, which is again costly. For online users, it would probably discourage them to view multimedia websites because it takes much time for these websites to download. (Multimedia Websites, 2005) In order to harness the benefits and advantages of multimedia, website developers and owners should consider some important factors. Initially, website owners and developers should determine whether there is a need to utilize multimedia, or to utilize multimedia minimally or fully.This requires determining the purpose, goals and objectives, and content of the web site. Some websites should only use audio or visual elements while other sophisticated websites need to use audio-visual and animation elements. The best way to utilize multimedia effectively is to use it judiciously. Website owners and developers would not want to overwhelm online users with complex and overlapping multimedia structures and they do not want to bore them with plain colors and texts either. (Kit & Kuan, 2006)Learning to control the use of multimedia and knowing when it is appropriate to utilize it is a primary consideration. The time and available financial resources should also be considered. In general, multimedia should be used in developing website if the operator or owner operates on multimedia elements. For instance, radio shows made available online need to establish multimedia website on audio elements. Websites hosting videos, such as YouTube. com for instance, need to maintain audio-visual elements of their multimedia website. Gaming websites, on the other hand, need to utilize animations.One reason for utilizing multimedia in websites is when operators or owners need to do promotions and advertisements through audio, visual or audio-visual means. Another reason is if there is a need to increase user participation and population by targeting user attraction and involvement through multimedia. Compare and Contrast Cookies and Spyware Spyware is an application or data that stealthily manage to enter computer systems or networks to spy on information or computer commands or processes recorded in the computer. The purpose of spyware is to obtain information or data covertly.In addition, the characteristic of spyware is naturally malicious. A user cannot delete it completely because it attaches itself to the system and spies on all computer processes and transactions. Spyware may be used to commit cyber crimes such as identity theft, because it collects private data and information. For example, spyware may be used to collect online bankin g information. Collected data will be used to conduct malicious transactions. (Olsen, 2005) Cookies, on the other hand, are information stored within the computer system.However, cookies are simply recorded for retrieval of information. For instance, cookies may retrieve user names or passwords when logging-in visited websites. (Cookies – Not Spyware, 2008) Cookies, unlike spyware, do not steal but simply make data records (Olsen, 2005) Although cookies seem to be harmless, it may be used instantly to serve the purpose of spywares. This depends on how cookies will be manipulated. For instance, if two people are sharing in one computer, the other might view cookies installed in the computer to determine what websites the other person has been visiting.He may also be able to access private e-mails or accounts on other websites, if the cookies allow automatic user name and password retrieval, and such. Moreover, that person might be able to open online accounts using the persona l information of the other person who he is sharing the computer with. Therefore, although cookies are normally harmless, people might use them to accomplish malicious activities such as identity theft or invasion of privacy. (Cookies – Not Spyware, 2008)

Thursday, January 9, 2020

Horrific Events Of Witch Trails - Free Essay Example

Sample details Pages: 5 Words: 1415 Downloads: 4 Date added: 2019/05/28 Category History Essay Level High school Tags: Salem Witch Trials Essay Did you like this example? The town of Salem Massachusetts, was founded in 1626 by Roger and a group of migrants. The settlements first name was Naumkeag, but they name was too hard so they called it Salem. The word Salem comes from the hebrew word for peace. Don’t waste time! Our writers will create an original "Horrific Events Of Witch Trails" essay for you Create order Salem a small and peace full town right on the great Atlantic Sea. Little do people know but this small town has a very, very dark history, which will be a permanent stain in Americas history. The name that would go down in many of our history books would be the name Salem Witch Trial, these horrific events happened from February of 1692 to May of 1693. Over this course of time more 200 people would be accused of being witches. The first witch accusation was in 1692 when a doctor diagnosed 7 teenage girls as being bewitched. More than 200 people will be accused and 19 people will be executed from those accusations. This was not one of the first time there have been witch trials in massachusetts, there was a previous 12 others were executed in the early 17 century. But Salem was by far the worst and most famous. Despite being known as the Salem Witch Trials the preliminary hearings in 1692 were conducted in several towns some were in Salem Village, Salem Town, Ipswich and Andover. The most famous trials were conducted in the Court of Oyer and Terminer in 1692 in Salem Town. Some people believe that there was so much hysteria because of their religious beliefs the town of Salem was a Puritan town they had very strong religious beliefs. A famous trial, and one of the first was the Sarah good trial. Sarah good was born in 1653 and was a daughter of a well off innkeeper. When her father died 1672 he left the family in debut. Her mother quickly married to a new husband, and paid off the debut, but as a result most of the family which were 2 sons and 7 daughter most of which never saw and of their late fathers estate. Sarah good married a former endenchered servant Daniel Poole. Poole died in in 1682 and left Sarah in more debut. Sarah then married her second husband William Good and he was held responsible for paying off her debuts his land was taken and Sarah and William became homeless. Sarah was one of the first 3 woman to be accused of witchcraft in Salem. She was charged with witchcraft after being identified as a witch by Tituba. She Fit the prevailing stereotype of of the malefic witch. Sarah Good would curse out towns people who would not give to her when she would beg on the streets. This brought in a lot of t estaments against her during her trial. The worst part of this trial was when Sarahrs child Dorcas Good, she was arrested and gave a confession which implicated Sarah as a witch. During the trail Sarah was described as forlorn and friendless and a broken down creature. Sarah was presumed guilty from the beginning of the trial and the courts mind was made up even before the trail started. Sarah Good was executed in July 19. In the Sarah good trial it there was no real evidence against her beside fingers being pointed at her. In my opinion they just accused her as a witch because they just wanted to get rid of her, the towns people didnt like and she was homeless and a bum. They just used the opportunity to get rid of her. Plus since the town of Salem were heavy believer in the puritan religion that it was easy to convince the town she was a sinner for being a witch. Another famous trail was the trail of Rebback nurse, this trail was one of the Salem Witch trials most famous and well known events. Rebback was a 71 year old grandmother, wife and local artisan. Rebback was arrested on March 24, 1692 after she was accused of being a witch. At the age of 71 she was accused of being a witch. Rebback was also sisters with a accused witch whose name was Mary Easty. Unlike Sarah Good Rebback was considered an upstanding citizen in Salem. She was accused of witchcraft by a woman whose name was Ann Putnam Jr and Abigail William and several others in Salem Village, Including the towns Reverend Deodat Lawson, who sai d Nursers spirit had been tormenting Ann Putnamrs home. During the trail which happened in June of 1692 Rebback nurse was found not guilty. This verdict was found not surprising to many because she was well liked and was upstanding. Also 39 people signed a petition to support her during her trial. But after the judge read the not guilty verdict the accusers of Rebback Nurse started to have fits and started to cry out her name. Then when Goody Hobbs was on trail he said Rebback nurse was one of them witch to the court meant she was a witch. Rebback Nurse wrote a statement saying she was one of them being a prisoner not a one of them being a witch. Then on July 3 1692 Rebback Nurse was arrested again after she was just freed and was convicted of being a witch. She was taken to the front of the local church for a public excommunicated. Which is essentially a public exacation. Later that night her son rowed out into the bay to claim his mothers body so she could have a proper christian burial. Like many witches there was no real actual eviden ce against her besides a group of people just accusing her of being a witch. Manu believe that Rebback Nurse and the Putnam family had a family feud and that they falsely accused her in the beginning. They just wanted to win there silly feud. That was the scary part about these times you could virtually just say someone was a witch and they would be arrested and executed. These punishment were only extreme because of the religion at the time and the hastara around the witch trial. The Salem Witch trials were one of Americas darkest times in our history. There have been many theories and conspiracies around these events. One conspiracy is that the first victim of witchCraft was actual suffering from epilepsy and or boredom to ergot poisoning(due to the ingestion of the alkaloids produced by the Claviceps purpurea fungus that infects rye), that is one of researches most suspected theories to the beginning of these event. Others say that many of the so called victims could have just fakes there symptoms for any number of reasons like a feud between families to almost anything. The second most common one is that a number of victims could have been suffering from a number of mental ailments. These was called mass conversion disorder it was a psychological disorder that was said to make a return 300 years after the trails. This could occur when people minds are in such mental anguish for any number of reasons that there mental ailments become physical. Hense cause t he shaking and foaming at the mouth and sickness. The results of the trails were quite surprising, Judge Samuel Sewall publicly confessed error and guilt. In 1702 the court declared the trails unlawful, and in 1711 the colony passed a bill restoring the rights and good names of those accused and granted 600 to their heirs. It was not until 1957 more than 250 years later that the Massachusetts apologized for the events of 1692. Which I think is quiet observed and seems a bit shameful that it took hundreds of year for them to apologize. The Salem Witch trials were a dark day in American history. These trials can be an example of exactly how powerful religion can be and was back in the 1600rs. In my opinion religion was the main cause for the mass hysteria, the people of Salem didnt did have the medilogical knowledge to explain it so society blamed it on religion. It could easily be backed up because the area at the time including Salema and surrounding towns had strong Puritans connections and beliefs. They could just blame someone and say they were a witch and didnt believe in Puritans beliefs and the court which was Puritans had no guilt handing out death sentences, plus the people usually accused were considered town charity cases and beggars and noises to the town much like Sarah Good. In conclusion I think there was no need for these trails and loss for human life and the 200 plus people accused of witchcraft should have lived.

Wednesday, January 1, 2020

Separation of Powers A System of Checks and Balances

The governmental concept of separation of powers enforced through a series of checks and balances was incorporated into the U.S. Constitution to ensure that no single person or branch of the new government could ever become too powerful. The system of checks and balances is intended to make sure that no branch or department of the federal government be allowed to exceed its bounds, to guard against fraud, and to allow for the timely correction of errors or omissions. Indeed, the system of checks and balances is intended to act as a sort of sentry over the separation of powers, balancing the authorities of the separate branches of government. In practical use, the authority to take a given action rests with one department, while the responsibility to verify the appropriateness and legality of that action rests with another. Founding Fathers like James Madison knew all too well from hard experience the dangers of unchecked power in government. Or as Madison himself put it, â€Å"The truth is that all men having power ought to be mistrusted.† Madison and his fellow framers believed that in creating any government administered by humans over humans, â€Å"You must first enable the government to control the governed; and in the next place, oblige it to control itself.† The concept of separation of powers, or â€Å"trias politica† dates to  18th century France, when social and political philosopher Montesquieu published his famed Spirit of the Laws. Considered one of the greatest works in the history of political theory and jurisprudence, Spirit of the Laws is believed to have inspired both the Declaration of the Rights and the Constitution. Indeed, the model of government conceived by Montesquieu had divided the political authority of the state into executive, legislative, and judicial powers. He asserted that ensuring that the three powers operate separately and independently was the key to liberty. In American government, these three powers of the three branches are: The legislative branch enacts the nation’s laws.The executive branch implements and enforces the laws enacted by the legislative branch.The judicial branch interprets the laws in reference to the Constitution and applies its interpretations to legal controversies involving the laws. So well-accepted is the concept of separation of powers, that the constitutions of 40 states specify that their governments be divided into similarly empowers legislative, executive, and judicial branches.   Three Branches, Separate But Equal In the provision of the three branches of governmental power—legislative, executive, and judicial – into the Constitution, the framers built their vision of a stable federal government as assured by a system of separation of powers with checks and balances. As Madison wrote in the Federalist Papers No. 51, published in 1788, â€Å"The accumulation of all powers, legislative, executive and judicial in the same hands, whether of one, a few, or many, and whether hereditary, self–appointed, or elective, may justly be pronounced the very definition of tyranny.† In both theory and practice, the power of each branch of American government is held in check by the powers of the other two in several ways. For example, while the President of the United States (executive branch) can veto laws passed by Congress (legislative branch), Congress can override presidential vetoes with a two-thirds vote of both houses. Similarly, the Supreme Court (judicial branch) can nullify laws passed by Congress by ruling them to be unconstitutional. However, the Supreme Court’s power is balanced by the fact that its presiding judges must be appointed by the president with the approval of the Senate. Specific examples of separation of powers through checks and balances include: Executive Branch Checks and Balances on the Legislative Branch President has the power to veto laws passed by CongressCan propose  new laws to CongressSubmits the Federal Budget to the House of RepresentativesAppoints federal officials, who carry out and enforce laws Executive Branch Checks and Balances on the Judicial Branch Nominates judges to the Supreme CourtNominates judges to the federal court systemPresident has the power to pardon or grant amnesty to persons convicted of crimes Legislative Branch Checks and Balances on the Executive Branch Congress can override presidential vetoes with a 2/3 vote of both chambersSenate can reject proposed treaties with a 2/3 voteSenate can reject presidential nominations of federal officials or judgesCongress can impeach and remove the president (House serves as prosecution, Senate serves as jury) Legislative Branch Checks  and Balances on the Judicial Branch Congress can create lower courtsSenate can reject nominees to the federal courts and Supreme CourtCongress can amend the Constitution to overturn decisions of the Supreme CourtCongress can impeach judges of the lower federal courts Judicial Branch Checks  and Balances on the Executive Branch Supreme Court can use the power of judicial review to rule laws unconstitutional Judicial Branch Checks  and Balances on the Legislative Branch Supreme Court can use the power of judicial review to rule presidential actions unconstitutionalSupreme Court can use the power of judicial review to rule treaties unconstitutional But Are the Branches Truly Equal? Over the years, the executive branch has—often controversially—attempted to expand its authority over the legislative and judicial branches. After the Civil War, the executive branch sought to expand the scope of the constitutional powers granted to the president as Commander in Chief of a standing army. Other more recent examples of largely unchecked executive branch powers include: the power to issue executive orders;the power to declare local and national emergencies;the power to grant and revoke security classifications;the power grant presidential pardons for federal crimes;the power to issue presidential bill signing statements; andthe power to withhold information from Congress through executive privilege. Some people argue that there are more checks or limitations on the power of the legislative branch than over the other two branches. For example, both the executive and judicial branches can override or nullify the laws it passes. While they are basically correct, it is how the Founding Fathers intended. Our system of separation of powers through checks and balances reflects the Founders’ interpretation of a republican form of government in which the legislative or lawmaking branch, as the most powerful branch, must also be the most restrained. The Founders believed this because the Constitution grants â€Å"We the People† the power to govern ourselves through the very laws we demand of the representatives we elect to the legislative branch. Or as James Madison put it in Federalist No. 48, â€Å"The legislative derives superiority†¦ [i]ts constitutional powers [are] more extensive, and less susceptible to precise limits†¦ [it] is not possible to give each [branch] an equal [number of checks on the other branches]†