0% found this document useful (0 votes)
7 views

SW 2023

The document describes a program that calculates the cost of an electric vehicle journey using multiple charging stations. It provides inputs like start mileage, stations used, and mileage at each station. The program calculates mileage and cost for each journey stage and the total journey cost. Tests are done to check the program outputs the correct costs given sample inputs.

Uploaded by

scottjdohnston
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

SW 2023

The document describes a program that calculates the cost of an electric vehicle journey using multiple charging stations. It provides inputs like start mileage, stations used, and mileage at each station. The program calculates mileage and cost for each journey stage and the total journey cost. Tests are done to check the program outputs the correct costs given sample inputs.

Uploaded by

scottjdohnston
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

ownloaded by [email protected] from 217.181.30.

9 on 17/01/2023 11:1

Task 1: software design and development


EVcharge is a company that runs an electric vehicle charging network. It requires a
program to provide users with a summary of their journey, and to calculate the cost for
using the charging network.

Program analysis
At the end of the journey, details are submitted to EVcharge to calculate the final cost.

Inputs
♦ The vehicle mileage at the start of the
journey.
♦ The number of charging stations visited.
♦ A valid kilowatt (kW) rating for each
charging station (7kW, 22kW or 50kW).
♦ The vehicle mileage at each charging
station.

For example, if making the journey from Aberdeen to Dumfries via Stirling (shown in the
diagram below), the user would enter:

♦ the vehicle mileage at the start of the journey (A)


♦ that two charging stations were visited (B and C)
♦ the kW rating of each of the two charging stations
♦ the vehicle mileage at each of the two charging stations (B and C)

Version 1.0 13
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

Process
♦ Calculate the number of miles travelled in each stage of the journey.
♦ Calculate the cost of each stage of the journey using the number of miles travelled and
the cost per mile, based on the kW rating of the charging station as shown below:
— 7kW = £0 per mile
— 22kW = £0.005 per mile
— 50kW = £0.01 per mile
♦ Calculate the total number of miles travelled from the start to the end of the journey.
♦ Calculate the total cost for the journey.

Outputs
♦ The total number of miles travelled.
♦ The cost (£) of each stage of the journey.
♦ The total cost (£) rounded to two decimal places.

Assumption(s)
♦ The user will complete the journey using no more than 10 charging stations.

Version 1.0 14
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

Task 1: software design and development (part A)


1a Input validation is used to check that a valid kW rating has been entered for a
charging station.

Using the information provided in the program analysis, design how this process could
be carried out. You can use a flowchart, structure diagram or pseudocode design.

(3 marks)

♦ Check your answers carefully, as you cannot return to part A after you hand it in.
♦ When you are ready, hand part A to your teacher or lecturer and collect part B.

Candidate name________________________ Candidate number________________________

Version 1.0 15
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

Task 1: software design and development (part B)


Program design (structure diagram)

Main steps

Refinement of ‘Get journey details’

Version 1.0 16
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

Refinement of ‘Calculate and store the cost of each stage of the journey’

Refinement of ‘Display total miles, journey stage costs and total cost’

Version 1.0 17
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

1b Using the program analysis and the design, implement the program in a language of
your choice.

Ensure the program matches the structure diagram given.

(15 marks)
Print evidence of your program code.

1c(i) Your program should be tested to ensure it produces the correct output.

Use the test data provided below to check that your program produces the correct
output.

Type of test User input Expected output Actual output


Normal Miles at start 1200 Journey stage 1 Attach printouts of
cost = 0.60 inputs and outputs
2 charge stations as evidence
visited Journey stage 2
cost = 0.91
Charge station 1
♦ 1320 miles Total cost = 1.51
♦ 22kW
Total miles = 211
Charge station 2
♦ 1411 miles
♦ 50kW

Print evidence of the test showing inputs and outputs.

(1 mark)

Version 1.0 18
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

(ii) In the test data below, the mileage entered at Charge station 2 is not correct.

Complete the test table below — this will show that the program is not fit for
purpose.

(2 marks)

Test data Expected results


Miles at start 18000
Journey stage 1 cost = __________
2 charge stations visited
Journey stage 2 cost = __________
Charge station 1
♦ 18350 miles Total cost = __________
♦ 7kW
Total miles = __________
Charge station 2
♦ 17800 miles
♦ 50kW

(iii) With reference to the test data above, describe how to make the program fit for
purpose.

(1 mark)

Candidate name___________________ Candidate number______________________

Version 1.0 19
ownloaded by [email protected] from 217.181.30.9 on 17/01/2023 11:1

1d With reference to your code, evaluate your program by commenting on the following:

Efficiency of your program code (1 mark)

Robustness of your completed program (1 mark)

Readability of your code (1 mark)

Candidate name________________________ Candidate number_______________________

Version 1.0 20

You might also like