S
Samara Galvao
I am a beginner, and I am having problems trying to solve some basic
questions. Can anyone help me?
Those are the problems I am trying to solve.
Q1)
There is a list of 1,000,000 usernames stored in a zero-based string
array. The usernames are in alphabetic order. The programming language
you are using has no automated method for searching arrays to find
matches. Language functions at your disposal are:
Lbound(array) Gets the lowest index of an array
Ubound(array) Gets the highest index of an array
Round(decimal) Rounds up or down decimal values
Strcomp(string1, string2) Returns 0 if a match is found
Returns 1 if string2 is lower in the alphabet than string1
Returns -1 if string2 is higher in the alphabet that string1
What type of method would you use to search for a specific username?
Write a simple code.
Q2)
The following information is contained in a spreadsheet, and is used by
a computer retailer to determine the products that are in-stock at their
various stores.
Store City Product Price Quantity
Virginia Outlet #1 Vienna Hypertext Builder 12.00 30
Washington Outlet #1 Redmond Hypertext Builder 12.00 30
Virginia Outlet #1 Vienna Windows XP Home 199.00 20
Washington Outlet #1 Redmond Windows XP Home 199.00 60
Illinois Outlet #44 Chicago Windows XP Home 199.00 80
Washington Outlet #1 Redmond Extera Design Suite 222.00 130
Create a database table schema that expresses the above information in a
normalized fashion.
Q3)
There are two database tables, one that stores customers and one that
stores addresses. They have the following structures
tCustomer
Customer_ID int Primary Key
First_Name varchar(255)
Last_Name varchar(255)
Email varchar(255)
tCustomer_Address
Address_ID int Primary Key
Address1 varchar(255)
Address2 varchar(255)
Address3 varchar(255)
State varchar(4)
City varchar(255)
Zip varchar(16)
Customer_ID int Foreign Key: tCustomer.Customer_ID
Write one query that will return the following information about each
customer.
First Name, Last Name
Address 1, Address 2, Address 3, State, City, Zip
A customer should appear in the results even if he/she does not have an
address in the database. In the event a customer has multiple
addresses, it is acceptable that their name shows up in the results more
than once.
Q4)
A candy company sells candy bars, and utilizes software to gauge a
variety of factors related to the product. What they need is a class
that:
Exposes the following properties:
Weight (in ounces)
Price (in dollars)
Fat Content
Calories
Taste Ranking
(1 to 10, 1 = tastes like health food, 10 = tastes awesome)
Provides the following functions:
A function that returns fat content per ounce
A function that returns calories per ounce
A function that returns price per ounce
Using Java/C#/VB/VB.NET, create a class that delivers the above, and
demonstrate how it might be utilized in surrounding code.
questions. Can anyone help me?
Those are the problems I am trying to solve.
Q1)
There is a list of 1,000,000 usernames stored in a zero-based string
array. The usernames are in alphabetic order. The programming language
you are using has no automated method for searching arrays to find
matches. Language functions at your disposal are:
Lbound(array) Gets the lowest index of an array
Ubound(array) Gets the highest index of an array
Round(decimal) Rounds up or down decimal values
Strcomp(string1, string2) Returns 0 if a match is found
Returns 1 if string2 is lower in the alphabet than string1
Returns -1 if string2 is higher in the alphabet that string1
What type of method would you use to search for a specific username?
Write a simple code.
Q2)
The following information is contained in a spreadsheet, and is used by
a computer retailer to determine the products that are in-stock at their
various stores.
Store City Product Price Quantity
Virginia Outlet #1 Vienna Hypertext Builder 12.00 30
Washington Outlet #1 Redmond Hypertext Builder 12.00 30
Virginia Outlet #1 Vienna Windows XP Home 199.00 20
Washington Outlet #1 Redmond Windows XP Home 199.00 60
Illinois Outlet #44 Chicago Windows XP Home 199.00 80
Washington Outlet #1 Redmond Extera Design Suite 222.00 130
Create a database table schema that expresses the above information in a
normalized fashion.
Q3)
There are two database tables, one that stores customers and one that
stores addresses. They have the following structures
tCustomer
Customer_ID int Primary Key
First_Name varchar(255)
Last_Name varchar(255)
Email varchar(255)
tCustomer_Address
Address_ID int Primary Key
Address1 varchar(255)
Address2 varchar(255)
Address3 varchar(255)
State varchar(4)
City varchar(255)
Zip varchar(16)
Customer_ID int Foreign Key: tCustomer.Customer_ID
Write one query that will return the following information about each
customer.
First Name, Last Name
Address 1, Address 2, Address 3, State, City, Zip
A customer should appear in the results even if he/she does not have an
address in the database. In the event a customer has multiple
addresses, it is acceptable that their name shows up in the results more
than once.
Q4)
A candy company sells candy bars, and utilizes software to gauge a
variety of factors related to the product. What they need is a class
that:
Exposes the following properties:
Weight (in ounces)
Price (in dollars)
Fat Content
Calories
Taste Ranking
(1 to 10, 1 = tastes like health food, 10 = tastes awesome)
Provides the following functions:
A function that returns fat content per ounce
A function that returns calories per ounce
A function that returns price per ounce
Using Java/C#/VB/VB.NET, create a class that delivers the above, and
demonstrate how it might be utilized in surrounding code.