Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Assignment_1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
#*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
*.framework

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
Pods
309 changes: 309 additions & 0 deletions Assignment_1/Assignment_1.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objects = {

/* Begin PBXBuildFile section */
CB249575279F108B00309624 /* Tax.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB249574279F108B00309624 /* Tax.swift */; };
CB3077FF2795368000928221 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB3077FE2795368000928221 /* main.swift */; };
CB451FA9279FE8FF00213496 /* Items.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB451FA8279FE8FF00213496 /* Items.swift */; };
CB8965FB279FE0BC001BAC6C /* ManufacturedItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB8965FA279FE0BC001BAC6C /* ManufacturedItem.swift */; };
CB8965FD279FE0D8001BAC6C /* RawItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB8965FC279FE0D8001BAC6C /* RawItem.swift */; };
CB8965FF279FE0E7001BAC6C /* ImportedItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB8965FE279FE0E7001BAC6C /* ImportedItem.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
CB3077F92795368000928221 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
CB22823D2799C84A00115B8C /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
CB249574279F108B00309624 /* Tax.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tax.swift; sourceTree = "<group>"; };
CB3077FB2795368000928221 /* Assignment_1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Assignment_1; sourceTree = BUILT_PRODUCTS_DIR; };
CB3077FE2795368000928221 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
CB451FA8279FE8FF00213496 /* Items.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Items.swift; sourceTree = "<group>"; };
CB8965FA279FE0BC001BAC6C /* ManufacturedItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManufacturedItem.swift; sourceTree = "<group>"; };
CB8965FC279FE0D8001BAC6C /* RawItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawItem.swift; sourceTree = "<group>"; };
CB8965FE279FE0E7001BAC6C /* ImportedItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportedItem.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
CB3077F82795368000928221 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
CB3077F22795368000928221 = {
isa = PBXGroup;
children = (
CB22823D2799C84A00115B8C /* .gitignore */,
CB3077FD2795368000928221 /* Assignment_1 */,
CB3077FC2795368000928221 /* Products */,
);
sourceTree = "<group>";
};
CB3077FC2795368000928221 /* Products */ = {
isa = PBXGroup;
children = (
CB3077FB2795368000928221 /* Assignment_1 */,
);
name = Products;
sourceTree = "<group>";
};
CB3077FD2795368000928221 /* Assignment_1 */ = {
isa = PBXGroup;
children = (
CB3077FE2795368000928221 /* main.swift */,
CB451FA8279FE8FF00213496 /* Items.swift */,
CB249574279F108B00309624 /* Tax.swift */,
CB8965FA279FE0BC001BAC6C /* ManufacturedItem.swift */,
CB8965FC279FE0D8001BAC6C /* RawItem.swift */,
CB8965FE279FE0E7001BAC6C /* ImportedItem.swift */,
);
path = Assignment_1;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
CB3077FA2795368000928221 /* Assignment_1 */ = {
isa = PBXNativeTarget;
buildConfigurationList = CB3078022795368000928221 /* Build configuration list for PBXNativeTarget "Assignment_1" */;
buildPhases = (
CB3077F72795368000928221 /* Sources */,
CB3077F82795368000928221 /* Frameworks */,
CB3077F92795368000928221 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = Assignment_1;
productName = Assignment_1;
productReference = CB3077FB2795368000928221 /* Assignment_1 */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
CB3077F32795368000928221 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1320;
LastUpgradeCheck = 1320;
TargetAttributes = {
CB3077FA2795368000928221 = {
CreatedOnToolsVersion = 13.2.1;
};
};
};
buildConfigurationList = CB3077F62795368000928221 /* Build configuration list for PBXProject "Assignment_1" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = CB3077F22795368000928221;
productRefGroup = CB3077FC2795368000928221 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
CB3077FA2795368000928221 /* Assignment_1 */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
CB3077F72795368000928221 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CB8965FF279FE0E7001BAC6C /* ImportedItem.swift in Sources */,
CB249575279F108B00309624 /* Tax.swift in Sources */,
CB8965FD279FE0D8001BAC6C /* RawItem.swift in Sources */,
CB3077FF2795368000928221 /* main.swift in Sources */,
CB451FA9279FE8FF00213496 /* Items.swift in Sources */,
CB8965FB279FE0BC001BAC6C /* ManufacturedItem.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
CB3078002795368000928221 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
CB3078012795368000928221 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
CB3078032795368000928221 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
CB3078042795368000928221 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
CB3077F62795368000928221 /* Build configuration list for PBXProject "Assignment_1" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CB3078002795368000928221 /* Debug */,
CB3078012795368000928221 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CB3078022795368000928221 /* Build configuration list for PBXNativeTarget "Assignment_1" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CB3078032795368000928221 /* Debug */,
CB3078042795368000928221 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = CB3077F32795368000928221 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
41 changes: 41 additions & 0 deletions Assignment_1/Assignment_1/ImportedItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// RawTax.swift
// Assignment_1
//
// Created by Sanskar on 24/01/22.
//

import Foundation

class ImportedItem : Items
{
override init(_ name:String,_ quantity:Int,_ price:Double)
{
super.init(name, quantity, price)
}

override func calculateTax() -> Double
{
let finalCost : Double = (0.01 * price) + price
if( finalCost > 200)
{
return ((0.05 * finalCost) - price )
}
else if( finalCost > 100)
{
return (finalCost + 10 - price)
}
return (finalCost + 5 - price )
}

override func print()
{
super.print()
Swift.print("Type : imported")
Swift.print("Tax : \(calculateTax())")
Swift.print("Total price : \(calculateTax() + self.price)")

Swift.print()
Swift.print("-------------------------------------------------")
}
}
Loading