Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
hieunthe163816 committed Nov 1, 2023
0 parents commit a7bb879
Show file tree
Hide file tree
Showing 9 changed files with 503 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
298 changes: 298 additions & 0 deletions HomeworkLession5.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {

/* Begin PBXBuildFile section */
847CBDFA2AD459A200F1D661 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847CBDF92AD459A200F1D661 /* main.swift */; };
847CBE012AD459F000F1D661 /* Student.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847CBE002AD459F000F1D661 /* Student.swift */; };
847CBE032AD500DA00F1D661 /* Product.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847CBE022AD500DA00F1D661 /* Product.swift */; };
/* End PBXBuildFile section */

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

/* Begin PBXFileReference section */
847CBDF62AD459A200F1D661 /* HomeworkLession5 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = HomeworkLession5; sourceTree = BUILT_PRODUCTS_DIR; };
847CBDF92AD459A200F1D661 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
847CBE002AD459F000F1D661 /* Student.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Student.swift; sourceTree = "<group>"; };
847CBE022AD500DA00F1D661 /* Product.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Product.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

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

/* Begin PBXGroup section */
847CBDED2AD459A200F1D661 = {
isa = PBXGroup;
children = (
847CBDF82AD459A200F1D661 /* HomeworkLession5 */,
847CBDF72AD459A200F1D661 /* Products */,
);
sourceTree = "<group>";
};
847CBDF72AD459A200F1D661 /* Products */ = {
isa = PBXGroup;
children = (
847CBDF62AD459A200F1D661 /* HomeworkLession5 */,
);
name = Products;
sourceTree = "<group>";
};
847CBDF82AD459A200F1D661 /* HomeworkLession5 */ = {
isa = PBXGroup;
children = (
847CBDF92AD459A200F1D661 /* main.swift */,
847CBE002AD459F000F1D661 /* Student.swift */,
847CBE022AD500DA00F1D661 /* Product.swift */,
);
path = HomeworkLession5;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
847CBDF52AD459A200F1D661 /* HomeworkLession5 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 847CBDFD2AD459A200F1D661 /* Build configuration list for PBXNativeTarget "HomeworkLession5" */;
buildPhases = (
847CBDF22AD459A200F1D661 /* Sources */,
847CBDF32AD459A200F1D661 /* Frameworks */,
847CBDF42AD459A200F1D661 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = HomeworkLession5;
productName = HomeworkLession5;
productReference = 847CBDF62AD459A200F1D661 /* HomeworkLession5 */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
847CBDEE2AD459A200F1D661 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1500;
LastUpgradeCheck = 1500;
TargetAttributes = {
847CBDF52AD459A200F1D661 = {
CreatedOnToolsVersion = 15.0;
};
};
};
buildConfigurationList = 847CBDF12AD459A200F1D661 /* Build configuration list for PBXProject "HomeworkLession5" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 847CBDED2AD459A200F1D661;
productRefGroup = 847CBDF72AD459A200F1D661 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
847CBDF52AD459A200F1D661 /* HomeworkLession5 */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
847CBDF22AD459A200F1D661 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
847CBDFA2AD459A200F1D661 /* main.swift in Sources */,
847CBE012AD459F000F1D661 /* Student.swift in Sources */,
847CBE032AD500DA00F1D661 /* Product.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
847CBDFB2AD459A200F1D661 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
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;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
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;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
847CBDFC2AD459A200F1D661 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
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;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
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;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
};
name = Release;
};
847CBDFE2AD459A200F1D661 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
847CBDFF2AD459A200F1D661 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
847CBDF12AD459A200F1D661 /* Build configuration list for PBXProject "HomeworkLession5" */ = {
isa = XCConfigurationList;
buildConfigurations = (
847CBDFB2AD459A200F1D661 /* Debug */,
847CBDFC2AD459A200F1D661 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
847CBDFD2AD459A200F1D661 /* Build configuration list for PBXNativeTarget "HomeworkLession5" */ = {
isa = XCConfigurationList;
buildConfigurations = (
847CBDFE2AD459A200F1D661 /* Debug */,
847CBDFF2AD459A200F1D661 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 847CBDEE2AD459A200F1D661 /* 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>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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>SchemeUserState</key>
<dict>
<key>HomeworkLession5.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
67 changes: 67 additions & 0 deletions HomeworkLession5/Product.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// Product.swift
// HomeworkLession5
//
// Created by Hiếu đang cáu on 10/10/2023.
//

import Foundation

class Product{
var name: String
let id: String
var price: Double
var quantity: Int

init(name: String, id: String, price: Double, quantity: Int) {
self.name = name
self.id = id
self.price = price
self.quantity = quantity
}
}

class productManager{
var productList :[Product] = []

func addProduct(name: String, id: String, price: Double, quantity: Int){
let product : Product = Product.init(name: name, id: id, price: price, quantity: quantity)
productList.append(product)
}

func updateProduct(name: String, id: String, price: Double, quantity: Int){
for i in productList.indices{
if(productList[i].id == id){
productList[i].name = name
productList[i].price = price
productList[i].quantity = quantity
break
}
}
}

func showProducts(){
print("----List of Products----")
for i in productList{
print("Id: \(i.id) Name: \(i.name)")
print("Price: \(i.price) Quantity: \(i.quantity)")
print("----------------------")
}
}

func searchProductByName(name: String){
var check:Bool = false;
print("----Search Product----")
for i in productList{
if(i.name == name){
check = true
print("Id: \(i.id) Name: \(i.name)")
print("Price: \(i.price) Quantity: \(i.quantity)")
print("----------------------")
}
}
if(!check){
print("Không có sản phẩm có tên \(name) trong kho hàng")
}
}
}
Loading

0 comments on commit a7bb879

Please sign in to comment.