ProductsLogo
LogoStudy Documents
LogoAI Grader
LogoAI Answer
LogoAI Code Checker
LogoPlagiarism Checker
LogoAI Paraphraser
LogoAI Quiz
LogoAI Detector
PricingBlogAbout Us
logo

Command-line Calculator

Verified

Added on  2023/01/18

|5
|716
|43
AI Summary
This document discusses the development and design of a command-line calculator using Swift. It covers the use of arrays, strings, recursion, and iteration. It also explores command line arguments, class structure, exception handling, and automated testing. The document concludes with a bibliography of recommended books for further reading.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Running head: COMMAND-LINE CALCULATOR
Individual programming project:
Command-line calculator
Name of the Student
Name of the University
Author’s Note

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
1
COMMAND-LINE CALCULATOR
Program Design
The use of Swift is an odd choice for development of command line program since C language,
perl, Java or Ruby can be used as a traditional choice for the development of the calculator. But
the use of swift help in providing the following advantages:
Using it as the interpreted scripted language and compiles language for reducing the
compilation time and reducing the complexity of maintenance. It can thus help in
improving the execution time and create a bundle for selling to the public.
There is no need for switching the language and thus the programmer can improve the
skill while sticking to it.
The calculator is developed to work with integers and the different operators for performing
the different arithmetic operations.
Array and string manipulation
For the manipulation of string and array in command line the number operator is used for
the repetition of the sequence. The arrays are spliced and broken into sub strings for using the
substring separately. The syntax of the string used for the development of the calculator is kept
simple and readable for constructing it by passing arguments. For the development of the
program the calc file is imported and the programming is done to solve the expression that uses
the + and – operators. The validity of the command line argument is checked and a proper error
message is displayed and the program is exited. For performing the division, the outbound errors
are checked and a class is created for each of the problem domain.
Recursion and iteration is used for solving the problem of solving the expression using +
and – operators. The program is developed as the same file as calc given in the template and the
Document Page
2
COMMAND-LINE CALCULATOR
results are printed as a standard output and message are displayed according to it and standard
errors are also displayed.
Command line arguments
It is achieved with editing the schema and running the arguments.
Creating classes and methods in Swift
The class structure is used for defining the method of instance and encapsulating the
specific task to work with the intended functionality.
Exception Handling
Try is used for handling the exceptions and bringing the data to the application. There are
certain possibility that the data may not reach the application and this possibility is eliminated
with the implementation of APIs and building function in Json that throws the data by default.
The swift is familiar that the data might add error and thus a function is created that is used for
eliminating an event that does not throws any error in the project.
Automated testing
The testing is performed for checking the errors in the developed xcode and for the
testing of the application the device selected in Iphone 5 and all the possible path and
functionality is tested for finding the possible outcomes. Since it is a simple application the tests
are performed manually and for decreasing the likelihood for missing the outcomes decreases
gradually. The testing of the application can also help in reducing the bugs and make changes in
the codes for adding new feature and eliminating the bugs. The compatibility of the developed
Document Page
3
COMMAND-LINE CALCULATOR
application for different platform is also checked and the codes are documented for performing
the intended functionality.

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4
COMMAND-LINE CALCULATOR
Bibliography
Nolan, G. (2016). Agile Swift: Swift Programming Using Agile Tools and Techniques. Apress.
Nolan, G. (2017). Swift Unit Testing. In Agile Swift (pp. 25-60). Apress, Berkeley, CA.
Yamacli, S. (2016). Beginner's Guide to iOS 10 App Development Using Swift 3: Xcode, Swift
and App Design Fundamentals. CreateSpace Independent Publishing Platform.
Yamacli, S. (2017). Beginner's Guide to iOS 11 App Development Using Swift 4: Xcode, Swift
and App Design Fundamentals. CreateSpace Independent Publishing Platform.
1 out of 5
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]