| CARVIEW |
public class Emp
{
private String firstName;
private String lastName;
private Date birthDate;
private Date hireDate;
//constructor to initialize name, birth date, and hire date
public Emp (String first, String last, Date dateOfBirth, Date dateOfHire)
{
firstName = first;
lastName = last;
birthDate = dateOfBirth;
hireDate = dateOfHire;
}
//convert Emp to String format
public String toString()
{
return String.format(“%s, %s Hired: %s Birthday: %s”,
lastName, firstName, hireDate, birthDate);
}
}
Date.Java
//Date class declaration
public class Date
{
private int month; //1-12
private int day; //1-31 based on month
private int year; //any year
//constructor: call checkMonth to confirm proper value for month
//call checkDay to confirm proper value for day
public Date(int theMonth, int theDay, int theYear)
{
month = checkMonth(theMonth); //validate month
year = theYear; //could validate year
day = checkDay(theDay); //validate day
System.out.printf(“Date object constructor for date %s\n”, this);
}
//utility method to confirm proper month value
private int checkMonth (int testMonth)
{
if (testMonth>0 && testMonth <=12) //validate month
return testMonth;
else //month is invalid
{
System.out.printf(“Invalid month (%d) set to 1.”, testMonth);
return 1; //maintain object in consistent state
}
}
//utility method to confirm proper day value based on month and year
private int checkDay (int testDay)
{
//0 is ignored since daysPerMonth[0]=0 represents 0 months
//Month starts on the 2nd element after 0 (from 1-12)
int daysPerMonth[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
//check if day in range for month
if (testDay >= 1 && testDay <= daysPerMonth[month])
return testDay;
//check for leap year
if (month == 2 && testDay == 29 && (year % 400==0 ||
(year % 4 == 0 && year % 100 != 0)))
return testDay;
System.out.printf(“Invalid day (%d) set to 1.”, testDay);
return 1; //maintain object in consistent state
}
//return a String of the form month/day/year
//automatically invoked even without calling this method
public String toString()
{
return String.format(“%d/%d/%d”, month, day, year);
}
}
EmpTest.Java
//composition demonstration
public class EmpTest
{
public static void main (String args[])
{
Date birth = new Date(7,0,1980);
Date hire = new Date(9,5,2007);
Emp employee = new Emp(“Ana”, “Santos”, birth, hire);
System.out.println(employee);
}
}
]]>Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1 and saver2, with balances of P2000.00 and P3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest and print the new balances for both savers. Then set the annualInterestRate to 5%, calculate the next month’s interest and print the new balances for both savers.
Note: implement Accessor and Mutator Methods
Apply Garbage collector
Grades will be dependent to a well-written code and readability of your program.
]]>
Title – should contain variables, methods, and populace
Chapter 1 – The Problem and its Background
Introduction
§ Presentation of the problem
– what is the problem all about
§ The existence of an unsatisfactory condition, a felt problem that needs a solution
§ Rationale of the study
– the reason/s why it is necessary to conduct the study
§ A desire to find a better way of doing something or of improving a product
§ A desire to discover something
§ A link between the introduction and the statement of the problem
Statement of the Problem
§ There should be a general statement of the whole problem followed by specific questions or subproblems into which the general problem is broken up
Hypothesis
§ A proposal intended to explain certain facts or observations
Conceptual Framework
§ It becomes the central theme, the focus, the main thrust of the study. It serves as a guide in conducting the investigation.
§ Paradigm/s representation and discussion
Scope and Limitation of the Study
§ A brief statement of the general purpose of the study
§ The subject matter and topics studied and discussed
§ The locale of the study, where the data were gathered or the entity to which the data belong
§ The population or universe from which the respondents were selected
§ The period of the study
§ Includes the weakness of the study beyond the control of the researcher
Significance of the Study
§ The rationale, timelines, and/or relevance of the study
§ Possible solutions to existing problems or improvements to unsatisfactory conditions
§ Who are to be benefited and how they are going to be benefited? It must be shown who are the individuals, groups, or communities who may be placed in a more advantageous position on account of the study.
§ Possible implications. Implications include the possible causes of the problems discovered, the possible effects of the problems, and the remedial measures to solve the problems. Implications also include the good points of a system which ought to be continued or to be improved if possible.
Definition of Terms
§ Only terms, or phrases which have special or unique meanings in the study are defined
§ Terms should be defined operationally, that is, how they are used in the study
§ The researcher may develop his own definition from the characteristics of the term defined
§ Definitions may be taken from encyclopedias, books, magazines and newspaper articles, dictionaries, the internet, and other publications but the researcher must acknowledge his sources
§ Definitions should be as brief and clear as possible
§ Acronyms should always be spelled out
Chapter 2 – Related Literature and Studies
-
-
- The materials should be as recent as possible
- Materials must be as objective and unbiased as possible
- Materials must be relevant to the study
- Materials must not be too few but not too many
-
-
-
- For both the Literature and Studies provide Foreign and Local categories (minimum of seven and a maximum of 10)
-
Chapter 3 – Methods of Research and Procedures
Method of Research
§ Descriptive or experimental
Method of Collecting Data
§ The method of collecting data and the development of the instrument for gathering data must be explained
The Sampling Design
§ The size of the population
§ The margin of error and the proportion of the study population
§ The type or technique of sampling used
§ The actual computation of the sample
§ The sample
Footnotes: use American Psychological Association (APA)
]]>There are four types of tickets – premium, upper box A, upper box B, and general admission. Premium is 250 pesos, upper box A is 100 pesos, upper box B is 50 pesos, and general admission is 10 pesos.
Create a Java program that will allow the user to input the number of tickets sold for each type of ticket. The program in return will compute for the total ticket sales for each ticket type as well as the grand total ticket sales.
Ex. Ticket Type Input number of total ticket sales sold
Premium 100
Upper Box A 200
Upper Box B 200
General Admission 500
Sales.Txt
Ticket Price Total Tickets Sold Total Amount
250 100 25000.00
100 200 20000.00
50 200 10000.00
10 500 5000.00
Grand Total Amount: 60000.00
2. Using JCreator, create a Java program that will facilitate a Method Overloading activity given the ff. requirements:
input: two whole numbers
two double numbers
two String data
For each pair of input requirements, output the message “The two values are equal” if they are equal to one another. Otherwise, output “They are not equal.”
]]>While working with classes, we declare a reference variable of a class type and then, typically, using the operator new, we instantiate an object of that class type and store the address of the object into the reference variable.
The statement: Sum j = new Sum();
instantiate an object called j from class Sum.
Using the operator new to create a class object is called instantiation of the class.
public class Sum
{ double n1, n2;
void Outs(double a, double b)
{ System.ou.println(“The sum is ” + s);
}
public static void main(String[] args)
{ Sum j = new Sum();
j.n1 = 6.5;
j.n2 = 8.5;
j.Outs(j.n1, j.n2);
}
}
]]>The codes below will extract date and time from date/time format.
set talk off
set strictdate to 0
set century on
select 1
use sample
***** structure of sample.dbf *****
***** name character 10 *****
***** d datetime 8 *****
select 2
use datesample
***** structure of datesample.dbf *****
***** name character 10 *****
***** date character 10 *****
select 3
use timesample
***** structure of timesample.dbf *****
***** name character 10 *****
***** time character 11 *****
date2 = Ctod(“/”)
time2 = Ctot(“/:”)
cname=space(10)
t = space(22)
select 1
go top
do while !eof()
if month(d)=7 and year(d)=2007
date2=d
time2=d
t = right(ttoc(time2 ),11)
cname=name
select 2
append blank
replace name with cname, date with dtoc(date2)
select 3
append blank
replace name with cname, time with t
endif
select 1
skip
enddo
close all
Key issues:
1. Understanding the requirements of a problem is among the most difficult tasks that face a software engineer.
2. Doesn’t the customer know what is required?
3. Shouldn’t the end-users have a good understanding of the features and functions that will provide benefit?
“I know you think you understand what I said, but what you don’t understand is what I said is not what I mean.”
Requirements Engineering Tasks
1. Inception
– Software engineers ask a set of context-free questions. The intent is to establish a basic understanding of the problem, the people who want a solution, the nature of the solution that is desired, and the effectiveness of preliminary communication and collaboration between the customer and developer.
Asking the First Questions
The first set of context-free questions focuses on the customer and other stakeholders, overall goals, and benefits. For example, the requirements engineer might ask:
· Who is behind the request for this work?
· Who will use the solution?
· What will be the economic benefit of a successful solution?
· Is there another source for the solution that you need?
The questions help to identify the stakeholders, the measurable benefit of a successful implementation and possible alternatives.
The next set of questions enables the software team to gain a better understanding of the problem and allows the customer to voice his or her perceptions about a solution:
· How would you characterize “good” output that would be generated by a successful solution?
· What problem(s) will this solution address?
· Can you show me (or describe) the business environment in which the solution will be used?
· Will special performance issues or constraints affect the way the solution is approached?
The final set of questions focuses on the effectiveness of the communication activity itself. Gause and Weinberg call these “meta-questions” and propose the following (abbreviated) list:
· Are you the right person to answer these questions? Are your answers “official”?
· Are my questions relevant to the problem that you have?
· Am I asking too many questions?
· Can anyone else provide additional information?
· Should I be asking you anything else?
2. Elicitation –
Why elicitation is difficult: (Christel and Kang)
· Problems of scope – The boundary of the system is ill-define or the customers/users specify unnecessary technical detail that may confuse, rather than clarify, overall system objectives.
· Problems of understanding – The customers/users are not completely sure of what is needed, have a poor understanding of the capabilities and limitations of their computing environment, don’t have a full understanding of the problem domain, have trouble communicating needs to the system engineer, omit information that is believed to be “obvious”, specify requirements that conflict with the needs of other customers/users, or specify requirements that are ambiguous or untestable.
· Problems of volatility – The requirements change over time.
Collaborative Requirements Gathering
· Meetings are conducted and attended by both software engineers and customers.
· Rules for preparation and participation are established.
· An agenda is suggested that is formal enough to cover all important points but informal enough to encourage the free flow of ideas.
· A “facilitator” controls the meeting.
· A “definition mechanism” (can be work sheets, flip charts, or wall stickers or an electronic bulletin board, chat room, or virtual forum) is used.
· The goal is to identify the problem, propose elements of the solution, negotiate different approaches, and specify a preliminary set of solution requirements in an atmosphere that is conducive to the accomplishment of the goal.
3. Elaboration – focuses on developing a refined technical model of software functions, features, and constraints.
Elaboration is an analysis modeling action that is composed of a number of modeling and refinement tasks. Elaboration is driven by the creation and refinement of user scenarios that describe how the end-user (and other actors) will interact with the system. Each user scenario is parsed to extract analysis classes – business domain entities that are visible to the end-user. The attributes of each analysis class are defined and the services that are required by each class are identified. The relationships and collaboration between classes are identified and a variety of supplementary UML diagrams are produced.
The end-result of elaboration is an analysis model that defines the informational, functional, and behavioral domain of the problem.
4. Negotiation – is the process settling down of conflicts between parties.
Processes involved:
· Customers, users, and other stakeholders are asked to rank requirements and then discuss conflicts in priority.
· Risks associated with each requirement are identified and analyzed.
· Rough “guestimates” of development effort are made and used to assess the impact of each requirement on project cost and delivery time.
· Using an iterative approach, requirements are eliminated, combined, and/or modified so that each party achieves some measure of satisfaction.
5. Specification – means different things to different people. A specification can be a written document, a set of graphical models, a formal mathematical model, a collection of usage scenarios, a prototype, or any combination of these.
The specification is the final work product produced by the requirements engineer. It serves as the foundation for subsequent software engineering activities. It describes the function and performance of a computer-based system and the constraints that will govern its development.
6. Validation – examines the specification to ensure that all software requirements have been stated unambiguously; that inconsistencies, omissions, and errors have been detected and corrected; and that the work products conform to the standards established for the process, the project, and the product.
7. Management – is a set of activities that help the project team identify, control, and track requirement and changes to requirements at nay time as the project proceeds.
]]>
System – is a set of facts, principles, rules, classified and arranged in an orderly form so as to show a logical plan linking the various parts.
Computer-based system – is a set or arrangement of elements that are organized to accomplish some predefined goal by processing information.
System Elements
1. Software
– are computer programs, data structures, and related work products that serve to effect the logical method, procedure, or control that is required.
2. Hardware
– are electronic devices that provide computing capability, the interconnectivity devices (e.g., network switches, telecommunications devices) that enable the flow of data, and electromechanical devices (e.g., sensors, motors, pumps0 that provide external world function.
3. People
– are users and operators of hardware and software.
4. Database
– is a large, organized collection of information that is accessed via software and persists over time.
5. Documentation
– is a descriptive information (e.g., models, specifications, hardcopy manuals, on-line help files, Web sites) that portrays the use and/or operation of the system.
6. Procedures
– are the steps that define the specific use of each system element or the procedural context in which the system resides.
System Modeling
1. Defines the processes that serve the needs of the view under consideration.
2. Represent the behavior of the processes and the assumptions on which the behavior is based.
3. Explicitly define both exogenous and endogenous input to the model.
4. Represent all linkages (including output) that will enable the engineer to better understand the view.
· Exogenous inputs link one constituent of a given view with other constituents as the same level or other levels; endogenous input links individual components of a constituent at a particular view.
· World View WV = {D1, D2, …, Dn} D – domain
Di = {E1, E2, …, Em} E – element
Ej = {C1, C2, …, Ck} C – component
Restraining Factors in Constructing a System Model
1. Assumptions
– that reduce the number of possible permutations and variations, thus enabling a model to reflect the problem in a reasonable manner.
2. Simplifications
– that enable the model to be created in a timely manner.
3. Limitations
– that help to bound the system.
4. Constraints
– that will guide the manner in which the model is created and the approach taken when the model is implemented.
5. Preferences
– that indicate the preferred architecture for all data, functions, and technology.
]]>Program File : MethodOverload.java
Procedures : 1. Type the program file.
: 2. Save/Compile the program.
: 3. Using the Command Prompt (C:\>), execute the following:
Path = C:\jdk\bin (or look for the equivalent directory)
Javac MethodOverload.java (compiling the program)
: 4. Execute the program with test data.
Scenario1: Java MethodOverload 5
Output: The area is : 78.54
Scenario2: Java MethodOverload 5 3
Output: The area is : 12.5
Scenario3: Java MethodOverload
Output: error
Scenario4: Java MethodOverload 1 2 3
Output: error
public class MethodOverload
{ static double n1,n2,a;
static double area(double n1)
{ a = 3.1416 * n1*n1;
return a;
}
static double area(double n1, double n2)
{ a = 1/2.0 * n1*n1;
return a;
}
public static void main(String[] args)
{
if (args.length>2 || args.length<1)
System.out.println(“error”);
else
{
n1 = Double.parseDouble(args[0]);
if (args.length==1)
System.out.println(“The area is: “+ area(n1));
else
{
n2 = Double.parseDouble(args[1]);
System.out.println(“The area is: “+ area(n1,n2));
}
}
}
}
]]>Program File : Sum.java
Procedures : 1. Type the program file.
: 2. Save/Compile the program.
: 3. Using the Command Prompt (C:\>), execute the following:
Path = C:\jdk\bin (or look for the equivalent directory)
Javac Sum.java (compiling the program)
Java Sum 2 3 (running the program with test data)
: 4. The result should look like this:
The sum is: 5.0
: 5. If the command
java Sum 5
or
java Sum 1 2 3
is executed, a message “Invalid number of inputs!” will be displayed.
public class Sum
{
static double n1, n2;
public static void main( String args[] )
{
int numArgs = args.length;
if( numArgs >2 || numArgs < 2 )
System.out.println( “Invalid number of inputs.” );
else
{
n1 = Double.parseDouble( args[0] );
n2 = Double.parseDouble( args[1] );
System.out.println( “The sum is: ” + (n1+n2));
}
}
}
Note: In the command Java Sum 2 3, the first number 2 is args[0] while 3 is args[1].
The method length will count the number of arguments based from the user inputs.
]]>