Answered step by step
Verified Expert Solution
Question
1 Approved Answer
check all the answer is correct or not Individual Assignment Weightage: 8 0 % , 1 0 0 marks Introduction to Computer Science - Part
check all the answer is correct or not
Individual Assignment
Weightage: marks
Introduction to Computer Science Part marks
Construct a solution algorithm for the following problems. Your solution should contain:
A defining problem
A pseudo code algorithm
A desk check of the algorithm
Three test cases for each question. Two valid and one error test case
Question
The NextDay Delivery Service Provider provides the parcel delivery service within Singapore. The delivery charge is calculated based parcel weight shown below in the table,
Weight
Charge
Less than kg
$
kg
$
For each additional kg Max of kg
$
Design an algorithm that will prompt for, receive the parcel weight, calculate the delivery charge and print the value. The program is to repeat the processing until a sentinel weight of is entered.
Question
If you buy a property, you must pay the Buyer's Stamp Duty BSD It is calculated by multiplying the purchase price of the property with the stamp duty rate based on either residential or nonresidential property as shown below in the table. Purchase Price of the Property BSD Rates for Residential Properties BSD Rates for NonResidential Properties Less than $
$ $
Above $
For example, if the purchase price of a nonresidential property is $ the BSD would be $ x $
Design an algorithm that will prompt for and receive the purchase price of a property and property type residential or nonresidential and calculate the buyers stamp duty and print the value.
Question
There is a midyear bonus scheme in a sales organisation based on the sales performance for the first half of the year and only payout if the sales performance is on target or more or more The midyear bonus is computed using the formula below,
Employees salary details are maintained in a file that contains employee ID employee name and employee salary. Design an algorithm that will prompt for and receive the sale performance in percentage and compute the midyear bonus for each employee in the file and print the employee ID employee name and bonus.
Introduction to Computer Science Part marks
Implement the three questions algorithm in Part into Java programming. Your code should contain appropriate validations and must focus on code optimisation.
You need to submit:
Three Java code
For each question explain words how the logic works.
Three sample output screenshots
o Two normal and one error test cases
Mid Year BonusYear Bonus
Employee
Employees Salarys Salary
Sale Performance
Sale Performance
X
in put output process
total company sales
Question :
Input Processing Output
parcelweight Prompt for parcelweight
Get parcelweight
Check if weight is exit condition
Adjust weight ceil if max kg
Calculate deliverycharge
Display deliverycharge deliverycharge
A pseudo code algorithm
BEGIN
FUNCTION main
CREATE scanner for input
WHILE true DO
PROMPT "Enter parcel weight in kg to exit:
TRY
READ weight
IF weight THEN PRINT "Invalid weight. Please enter a positive number." CONTINUE
CATCH InputMismatchException
PRINT "Please enter a valid number." CLEAR input
IF weight THEN PRINT "Exiting program..." EXIT loop
IF weight THEN weight ceilingweight
IF weight THEN weight PRINT "Weight adjusted."
deliveryCharge calculateDeliveryChargeweight
PRINT "Delivery charge: $ deliveryCharge
ENDWHILE
CLOSE scanner
END FUNCTION
FUNCTION calculateDeliveryChargeweight
IF weight THEN RETURN ELSE IF weight THEN RETURN ELSE RETURN weight
END FUNCTION
END
A desk check of the algorithm
Desk Check
Input: kgkgkg
Data Set Data Set Data Set invalid
Parcelweight kg kg
Expected Results
Data Set D
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started