Goal:
After the manager of a local McDonalds hired several ASU grads to work the cash registers, he realized that they were having trouble figuring out the correct amount of change to return to their customers. The manager wants you to create a VB.NET program that calculates the correct amount of change to be given to a customer following a transaction.
Guidelines:
You should have
Inputs:
Transaction Amount
validation: data must have been entered, data must be numeric, amount cannot be negative or greater than $1000.00
Amount of Cash Provided By The Customer
validation: data must have been entered, data must be numeric,
amount cannot be negative and must be equal to or greater than the Transaction Amount
Outputs:
Total Amount of Change To Be Returned
Number of Twenties To Be Returned
Number of Tens To Be Returned
Number of Fives To Be Returned
Number of Ones To Be Returned
Number of Quarters To Be Returned
Number of Dimes To Be Returned
Number of Nickels To Be Returned
Number of Pennies To Be Returned
In: Computer Science
Guidelines
Look up one of the many sites describing the BMI, and read a bit about how it is used to indicate general health. Create a VB.Net program that, given a user’s height in inches and weight in pounds, will calculate and display his/her BMI. After calculating the user's BMI, indicate the user's health status.
BMI = (weight * 703) / (height * height)
Display the user’s Height Status:
|
BMI |
Health Status |
|
Below 18.5 |
Underweight |
|
18.5 -24.9 |
Normal |
|
25 - 29.9 |
Overweight |
|
30 & Above |
Obese |
Input: Height and Weight.
Output: BMI (to one decimal, like 27.7) and Weight Status (a string, like “Overweight”)
After the remarks at the top of your program, add “Option Explicit On” and “Option Strict On”. The former requires you to explicitly declare each variable used and the latter requires you to explicitly convert data from one type to another, rather than rely on VB.Net to implicitly convert data.
In: Computer Science
describe how prime numbers or quadratic congruence can be used to crack an encryption system?
In: Computer Science
Does anyone know how to find if a certain String is available in an ArrayList?
I was asked by my instructor to make a certain program about Student Record
In the area where I need to add some student in the ArrayList it won't add if there is the same name in the ArrayList
at first I used the equals method and contains method but later I found it was prohibited to use such method.
Is there a way to find if a String is Available in the ArrayList without using the method
Please check on else if(response==2)
import java.util.*;
public class performanceTask {
public static void main(String[] args) {
int response;
ArrayList<String>
listOfStudent = new ArrayList<String>();
Scanner aScanner = new
Scanner(System.in);
do {
System.out.println("[Selection Bar]");
System.out.println("[1] List of Students.");
System.out.println("[2] Add Student.");
System.out.println("[3] Edit Student.");
System.out.println("[4] Delete Student.");
System.out.println("[5] Clear list of Students.");
System.out.println("[6] Exit Program.");
System.out.println("--------------------------");
System.out.println("Select an option: ");
response =
aScanner.nextInt();
if(response ==
1) {
int size = listOfStudent.size();
if(size == 0) {
System.out.println("No
Records Found!\n");
} else {
Collections.sort(listOfStudent);
for(int i = 0;
i<listOfStudent.size(); i++) {
System.out.println(i + ". " + "[" + listOfStudent.get(i) +
"]");
}
System.out.println("\n");
}
}else if
(response == 2) {
System.out.println("Enter Name of a Student:
");
String addStudent = aScanner.next();
if (listOfStudent.contains(addStudent)) {
System.out.println(addStudent
+" already existed! \n");
} else {
System.out.println("Do you
want to save " + addStudent + "? [y/n]: ");
String saveIt =
aScanner.next();
if(saveIt.equals("y") || saveIt.equals("Y") ) {
listOfStudent.add(addStudent);
System.out.println(addStudent +" has been
successfully added! \n ");
}else if
(saveIt.equals("n") || saveIt.equals("n")) {
System.out.println("\n");
continue;
}else
{
System.out.println("It must be y or n
only!");
}
}
In: Computer Science
1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary format)
Hint: –17 + 0.375
Given the hint above, the fractional number will be divided into
two parts,
- Whole number,
- Fractional part, must be positive
(2) Proof to check that your calculation above is correct
In: Computer Science
Spatial indexing with quadtrees in python
The quadtrees data structure is a special type of tree structure, which can recursively divide a flat 2-D space into four quadrants. Each hierarchical node in this tree structure has either zero or four children. It can be used for various purposes like sparse data storage, image processing, and spatial indexing. Spatial indexing is all about the efficient execution of select geometric queries, forming an essential part of geo-spatial application design. For example, ridesharing applications like Ola and Uber process geo-queries to track the location of cabs and provide updates to users. Facebook’s Nearby Friends feature also has similar functionality. Here, the associated meta-data is stored in the form of tables, and a spatial index is created separately with the object coordinates. The problem objective is to find the nearest point to a given one. You can pursue quadtree data structure projects in a wide range of fields, from mapping, urban planning, and transportation planning to disaster management and mitigation. We have provided a brief outline to fuel your problem-solving and analytical skills. Objective: Creating a data structure that enables the following operations
Insert a location or geometric space
Search for the coordinates of a specific location
Count the number of locations in the data structure in a particular contiguous area
In: Computer Science
SYSTEM RECOVERY
It is highly probable that eventually something bad will happen to your data or your hardware. What can you do to lessen the impact of these problems? You can look at both hardware and software solutions. What is fault tolerance?
In: Computer Science
In: Computer Science
In C++
|
Circle |
|
-int x //x coord of the center -int y // y coord of the center -int radius -static int count // static variable to keep count of number of circles created |
|
+ Circle() //default constructor that sets origin to (0,0) and radius to 1 +Circle(int x, int y, int radius) // regular constructor +getX(): int +getY(): int +getRadius(): int +setX(int newX: void +setY(int newY): void +setRadius(int newRadius):void +getArea(): double // returns the area using formula pi*r^2 +getCircumference // returns the circumference using the formula 2*pi*r +toString(): String // return the circle as a string in the form (x,y) : radius +getDistance(Circle other): double // * returns the distance between the center of this circle and the other circle +moveTo(int newX,int newY):void // * move the center of the circle to the new coordinates +intersects(Circle other): bool //* returns true if the center of the other circle lies inside this circle else returns false +resize(double scale):void// * multiply the radius by the scale +resize(int scale):Circle // * returns a new Circle with the same center as this circle but radius multiplied by scale +getCount():int //returns the number of circles created //note that the resize function is an overloaded function. The definitions have different signatures |
Create "Circle.h"
Create "Circle.cpp"
Complete Main.cpp
#include<iostream>
#include "Circle.h"
#include <fstream>
#include <vector>
#include<cstdlib>
#include <fstream>
#include <sstream>
void inputData(vector<Circle> &circleVector, string
filename){
//create the input string stream called instream
//open file
//if there is a problem opening the file, throw an exception and
exit - use a try catch statement
//otherwise
//use getline to read data line feed to the instream
//create a circle using the data in the instream
//add the circles to the vector
//keep doing this until all the data in the file is read
}
int main(){
cout<<"The number of circles, using getCount method is
"<<//<<endl;
cout<<"The numher of circles, using vetor size method is
"<<//<<endl;
//clear vector
cout<<"The number of circles, using getCount method is
"<<//<endl;
cout<<"The number of circles remaining is ";
return 0;
}
file "dataLab4.txt" contains:
0 0 4
0 0 6
-2 -9 6
4 5 7
7 8 9
In: Computer Science
I'm trying to convert between different number representations in C++ , I have the prototype but im not sure what do do from here
bool convertF(double & x, const string & bits);
bits is supposed to be an 8-bit (not 5-bit) value, each char being '0' or '1'; if not, return
false. The first bit of bits represents the sign bit, the next 3 bits represent the exponent,
and the next 4 bits represent the significand.
convertF may assume without checking that the 3 exponent bits are not all the same.
convertF's job is to set x to the floating-point number that bits represents and return
true.
For example, convertF(x, "101011000") should set x to -7/8 == -0.875
In: Computer Science
# ArrayStack
# TODO:
push and pop using array stack with doubling technique.
import numpy as np
from future import print_function
# Definisi class ArrayStack
class ArrayStack(object):
def __init__(self):
self.data = np.zeros(20, dtype=np.int)
self.count = 0
def isEmpty(self):
pass # ubah saya
def size(self):
pass # ubah saya
def push(self, obj):
pass # ubah saya
def pop(self):
pass # ubah saya
#--------------------------
# End of class
if __name__ == "__main__":
stack = ArrayStack()
randn = np.random.permutation(1000)
for i in range(1000):
stack.push(randn[i])
####
for i in range(100):
print(stack.pop())
####In: Computer Science
Java
Create an abstract Product Class
Add the following private attributes:
name
sku (int)
price (double)
Create getter/setter methods for all attributes
Create a constructor that takes in all attributes and sets them
Remove the default constructor
Override the toString() method and return a String that represents
the building object that is formatted
nicely and contains all information (attributes)
Create a FoodProduct Class that extends Product
Add the following private attributes:
expDate (java.util.Date) for expiration date
refrigerationTemp (int) if 70 or above, none necessary, otherwise it will be a lower number
servingSize (int) in grams
caloriesPerServing (int)
allergens (ArrayList<String>)
Create getter/setter methods for all attributes
Create a constructor that takes in all attributes for product and food product. Call the super constructor and then set the expDate, refrigerationTemp, servingSize, caloriesPerServing and allergens.
Remove the default constructor
Override the toString() method and return a String that represents the food product object that is formatted nicely and contains all information (super toString and the private attributes)
Create a CleaningProduct Class that extends Product
Add the following private attributes:
String chemicalName
String hazards
String precautions
String firstAid
ArrayList<String> uses (e.g. kitchen, bath, laundry, etc)
Create getter/setter methods for all attributes
Create a constructor that takes in all attributes for product and food product. Call the super constructor and then set the chemical name, hazard, precautions, firstAid and uses. TIP: try generating the constructor, it will add the super stuff for you. (Also, see Lynda inheritance videos.)
Remove the default constructor
Override the toString() method and return a String that represents the cleaning product object that is formatted nicely and contains all information (super toString() and the private attributes)
Create the interface Edible which contains the following method signatures:
public Date getExpDate();
public void setRefrigerationTemp(Int refrigerationTemp)
public int getRefrigerationTemp();
public void setExpDate(Date expDate) ;
public int getServingSize() ;
public void setServingSize(int servingSize) ;
public int getCaloriesPerServing() ;
public void setCaloriesPerServing(int caloriesPerServing);
public String getAllergens() ;
public void setAllergens(ArrayList<String> allergens) ;
Create the interface Chemical which contains the following method signatures
public String getChemicalName();
public void setChemicalName(String chemicalName) ;
public String getHazards() ;
public void setHazards(String hazards);
public String getPrecautions() ;
public void setPrecautions(String precautions) ;
public ArrayList<String> getUses() ;
public void setUses(ArrayList<String> uses) ;
public String getFirstAid() ;
public void setFirstAid(String firstAid) ;
Modify the FoodProduct Class to implement Edible, be sure to add the @Override before any methods that were there (get/set methods) that are also in the Edible interface.
Modify the CleaningProduct Class to implement Chemical, be sure to add the @Override before any methods that were there (get/set methods) that are also in the Chemical interface.
Create your main/test class to read products from a file, instantiate them, load them into an ArrayList and then print them nicely to the console at the end of your program. See instructor note about reading the file as the lengths of the lines may be different depending on the list of allergens. It is also comma delimited rather than by spaces. You will have to read an entire line, split its contents and then store the information into variables. The last element(s) are the allergens that you will have to store to an ArrayList.
2 note files:
Frosted Mini Wheats,233345667,4.99,10/2020,70,54,190,Wheat Ingredients Activa YoCrunch Yogurt,33445654,2.50,10/2018,35,113,90,Dairy,Peanuts
Lysol,2344454,4.99,Alkyl (50%C14 40%C12 10%C16) dimethyl benzyl
ammonium saccharinate,Hazard to humans and domestic animals.
Contents under pressure,Causes eye irritation,In case of eye
contact immediately flush eyes thoroughly with water, kitchen,
bath
Windex,4456765,3.99,Sodium citrate (Trisodium citrate),To avoid
electrical shock do not spray at or near electric lines,Undiluted
product is an eye irritant, if contact with eye occurs flush
immediately with plenty of water for at least 15 to 20 minutes,
glass, upholstery, clothing
In: Computer Science
#define _CRT_SECURE_NO_WARNINGS
// Put your code below:
#include <stdio.h>
int main(void)
{
int day, hightemp[10], lowtemp[10], numbers, highesttemp,
highestday, lowesttemp, lowestday, numbers2 = 0, hightotal = 0,
lowtotal = 0, averageday = 0, numbers3;
double averagetemp;
printf("---=== IPC Temperature Calculator V2.0 ===---");
printf("\nPlease enter the number of days, between 3 and 10,
inclusive: ");
scanf("%d", &numbers);
if (numbers < 3 || numbers > 10)
{
printf("\nInvalid entry, please enter a number between 3 and 10,
inclusive: ");
scanf("%d", &numbers);
printf("\n");
}
while (numbers < 3 || numbers > 10);
for (day = 1; day <= numbers; day++)
{
printf("Day %d - High: ", day);
scanf("%d", &hightemp[day - 1]);
printf("Day %d - Low: ", day);
scanf("%d", &lowtemp[day - 1]);
if(highesttemp <= highesttemp[day - 1])
{
highesttemp = highesttemp[day - 1];
highesttemp = day;
}
if (lowesttemp >= lowesttemp[day - 1])
{
lowesttemp = lowesttemp[day - 1];
lowesttemp = day;
}
}
printf("\nDay Hi Low\n");
for (day = 1; day <= numbers; day++)
{
printf("%d %d %d\n", day, hightemp[day - 1], lowtemp[day - 1]);
}
printf("\nThe highest temperature was %d, on day %d\n", highesttemp, highestday);
printf("The lowest temperature was %d, on day %d\n", lowesttemp, lowestday);
while (numbers2 == 0)
{
printf("\nEnter a number between 1 and 5 to see average temperature
for the entered number of days, enter a negative number to exit: ",
numbers);
scanf("%d", &numbers3);
if (numbers3 < 0)
{
numbers2 = 1;
}
else
{
while (numbers3 <= 0 || numbers3 > numbers)
{
printf("\nInvalid entry, please enter a number between 1 and %dm
inclusive: ", numbers);
scanf("%d", &numbers3);
}
hightotal = 0;
lowtotal = 0;
for (averageday = 1; averageday <= numbers3;
averageday++)
{
hightotal += hightemp[averageday - 1];
lowtotal += lowtemp[averageday - 1];
}
averagetemp = (double) (hightotal + lowtotal) / (numbers3 * 2);
printf("\nThe average temperature up to day %d is: %.2lf",
numbers3, averagetemp);
}
}
printf("\nGoodbye!");
return 0;
}
/////////////////////////////////////////////////////////////////////////
why is it not working?
In: Computer Science
SYSTEM REQUIREMENTS-
Each dog goes through a six- to ninemonth training regimen before they are put into service. Part of our process is to record and track several data points about the rescue animals.
Dogs are given the status of "intake" before training starts. Once in training, they move through a set of five rigorous phases: Phase I, Phase II, Phase III, Phase IV, and Phase V. While in training, a dog is given the status of its current training phase (e.g., "Phase I"). When a dog graduates from training, it is given the status of "in service" and is eligible for use by clients. If a dog does not successfully make it through training, it is given the status of "farm," indicating that it will live a life of leisure on a Grazioso Salvare farm.
The Animals Through years of experience, we have narrowed the list of dog breeds eligible for rescue training to the following:
• American pit bull terrier • Beagle • Belgian Malinois • Border collie • Bloodhound • Coonhound • English springer spaniel • German shepherd • German shorthaired pointer • Golden retriever • Labrador retriever • Nova Scotia duck tolling retriever • Rough collie • Smooth collie
When we acquire a dog, we record the breed, gender, age, weight, date, and the location where we obtained them. There is usually a short lag time between when we acquire a dog and when they start training, which we document as well. Additionally, we track graduation dates, dates dogs are placed into "service," and details about the dogs' in-service placement (agency, city, country, and name, email address, phone number, and mailing address for the agency's point of contact).
RESCUE ANIMAL CODE
import java.text.SimpleDateFormat;
public class RescueAnimal {
// Class variables
private String name;
private String type;
private String gender;
private int age;
private float weight;
private SimpleDateFormat acquisitionDate;
private SimpleDateFormat statusDate;
private String acquisitionSource;
private Boolean reserved;
private String trainingLocation;
private SimpleDateFormat trainingStart;
private SimpleDateFormat trainingEnd;
private String trainingStatus;
private String inServiceCountry;
private String inServiceCity;
private String inServiceAgency;
private String inServicePOC;
private String inServiceEmail;
private String inServicePhone;
private String inServicePostalAddress;
// Constructor
public RescueAnimal() {
}
// Add Accessor Methods here
// Add Mutator Methods here
}
In: Computer Science
Write a function sublist that takes two lists as arguments, and returns true if the first list appears as a contiguous sublist somewhere within the second list, and false otherwise.
> (sublist ’(c d e) ’(a b c d e f g))
#t
> (sublist ’(a c e) ’(a b c d e f g))
#f
Write a function lgrep that returns the “lines” within a list that contain a given sublist. Use the sublist function implemented in previous exercise to build lgrep.
> (lgrep ’(c d e) ’((a b c d e f g)
(c d c d e)
(a b c d)
(h i c d e k)
(x y z)))
((a b c d e f g) (c d c d e) (h i c d e k))
You may assume that all elements of (all lines of) all argument lists are atoms.
using the programming language scheme
i need the question to be answered using the programming language Scheme
In: Computer Science