Questions
AI Question: Consider a simple reflex agent maps a state to a single action. Suppose there...

AI Question:

Consider a simple reflex agent maps a state to a single action. Suppose there exists a world with S states and A possible actions in any of these states. How many distinct simple reflex agents can exist in such a world? Or equivalently, how many functions f can there be for some f(s) = a?

In: Computer Science

Programming 3: Multi-Way Branching Shipping Charges The Fast Freight Shipping Company charges the following rates: Given...

Programming 3: Multi-Way Branching

Shipping Charges

The Fast Freight Shipping Company charges the following rates:

  • Given the Weight of Package (in Kilograms), use the following Rate ($) per 500 Miles Shipped.

  • 2 kg or less = $1.10 per 500 Miles Shipped

  • Over 2 kg but not more than 6 kg = $2.20 per 500 Miles Shipped

  • Over 6 kg but not more than 10 kg = $3.70 per 500 Miles Shipped

  • Over 10 kg but not more than 20 kg = $4.80 per 500 Miles Shipped

Write a program that reads the weight of the package and the distance it is to be shipped, and then displays the charges to two decimal points.

  • Input Validation:
  • Do not accept values of 0 or less for the weight of the package.
    • Print "ILLEGAL WEIGHT: BELOW MINIMUM"
  • Do not accept weights of more than 20 kg (this is the maximum weight the company will ship).
    • Print "ILLEGAL WEIGHT: ABOVE MAXIMUM"
  • Do not accept distances of less than 10 miles or more than 3,000 miles. These are the company’s minimum and maximum shipping distances.
    • Print "ILLEGAL DISTANCE"

I got stuck here:

#include
using namespace std;

int main(){
int i=0,miles;
   double j,weight,cost,distance;

   cin>>weight;
      if(weight<=0){
         cout<< "ILLEGAL WEIGHT: BELOW MINIMUM" << endl;
      }
      else(weight>20){
         cout<< "ILLEGAL WEIGHT: ABOVE MAXIMUM" << endl;
      }
       

   cin>>distance;
      while(distance<10 || distance >3000){
         cout<< "ILLEGAL DISTANCE" << endl;
      }
   i=miles/500;
   j=miles%500;

   if(j>0){
       i=i+1;
   }
   if(weight<=2){
       cost=i*1.10;
   }
   else if(weight>2 && weight<=6){
       cost=i*2.20;
   }
   else if(weight>6 && weight<=10){
       cost=i*3.70;
   }
   else if(weight>10 && weight<=20){
       cost=i*4.80;
   }
   cout<<"Cost of Shipping: " << cost;
   return 0;
}

Random inputs are....

Input : -1 2000

Expected inputs are : ILLEGAL WEIGHT: BELOW MINIMUM

Input: 1 5000

Expected output : ILLEGAL DISTANCE

input: 2 2000

Expected output : 4.40 (<--| enter symbol)

Please revise and let me know what i did wrong.....

In: Computer Science

Python Create Loop 1 = 1 1 + 2 = 3 1 + 2 + 3...

Python Create Loop

    1 = 1
    1 + 2 = 3 
    1 + 2 + 3 = 6
    1 + 2 + 3 + 4 = 10
    1 + 2 + 3 + 4 + 5 = 15

Create a loop in python that makes this pattern

In: Computer Science

Can someone tell me how to fix warning msg in my code of C ++? I...

Can someone tell me how to fix warning msg in my code of C ++?

I got run-time error for this question please help me asap!

Errors are:
In function 'void bfs(int, int)':
warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int j = 0; j < adj[pppp].size(); j++){
                  ^
In function 'int main()':
warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d %d %d %d %d", &a, &q, &c, &N, &m);
                                            ^
warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d %d", &fir, &bbb);
                         ^

#include <iostream>

#include <stdio.h>

#include <vector>

#include <algorithm>

#include <queue>

int min(int n,int arr[]){

int m=arr[0];

for(int i=1;i<n;i++)

if(m>arr[i])

m=arr[i];

return m;

}

using namespace std;

const int Max_max = 404040;

const int INF = 1e7;

int sum[Max_max];

int a,q,c,N,m,fir;

vector<int> adj[Max_max];

void bfs(int money, int start_node){

bool hello[Max_max];

for(int i=0; i<=N; i++)

hello[i] = false;

queue<int> q;

q.push(start_node);

hello[start_node] = true;

int distance = 1;

do{

int size = q.size();

for(int i = 0; i < size; i++){

int pppp = q.front(); q.pop();

for(int j = 0; j < adj[pppp].size(); j++){ //error undeclared identifier 'ppp_city'

int next = adj[pppp][j];

if(hello[next])

continue;

sum[pppp] += money * distance;

hello[next] = true;

q.push(next);

}

}

distance++;

} while (q.size() > 0);

}

int main(){

scanf("%d %d %d %d %d", &a, &q, &c, &N, &m);

for(int i=0; i < m; i++){

int aaa, bbb;

scanf("%d %d", &fir, &bbb);

adj[aaa].push_back(bbb);

adj[bbb].push_back(aaa);

}

bfs(a,1);

bfs(q,2);

bfs(c,N);

int fin = INF;

for(int i = 1; i <= N; i++)

fin = min(fin, sum); //error no matching function to call min

printf("%d",fin);

return 0;

}

In: Computer Science

Discuss how the ability of companies to stream movies and TV programs on demand to our...

Discuss how the ability of companies to stream movies and TV programs on demand to our homes is changing our viewing habits. Contrast the offerings of providers such as Hulu and Netflix.

In: Computer Science

What is the first valid host on the Subntwork that the node 192.168.105.35 255.255.255.248 belOngs to?...

What is the first valid host on the Subntwork that the node 192.168.105.35 255.255.255.248 belOngs to?
with steps pls .. thanks

In: Computer Science

Assume a user wants to classify numbers in terms of whether they are “divisible by 2”,...

Assume a user wants to classify numbers in terms of whether they are “divisible by
2”, “divisible 3”, “both visible by 2 and 3” and “neither divisible by 2 nor 3”. Clearly
for each integer, only one of the classes is most accurate.
Write a SPIM program which allows a user to enter 5 integers and for each of them,
determines which of the mentioned classes it belongs to.

In: Computer Science

USING THE IF STATEMENT & Scanner for input and println for output - Write a java...

  1. USING THE IF STATEMENT & Scanner for input and println for output - Write a java program where the user enters a temperature as a whole number from input, and outputs a “most likely” season [either SUMMER, SPRING, FALL or WINTER] depending on the temperature entered.

SUMMER would be 90 or higher

SPRING   would be 70 to less than 90

FALL       would be 50 to less than 70

WINTER would be less than 50

Consider it an error if the user ever accentually enters a value less than 0, greater than 110.

In: Computer Science

c++ students.txt 20 Shawn Lynch 2.0 Hasan Stephens 2.6 Frank Wright 2.7 Hugo Ray 2.9 Justin...

c++

students.txt

20

Shawn Lynch 2.0
Hasan Stephens 2.6
Frank Wright 2.7
Hugo Ray 2.9
Justin Gardner 3.0
Kelly Jenkins 2.2
Rafael Seymour 3.7
Jose Cantu 0.6
David Gilmore 1.3
Emma Paterson 2.1
Jackie White 1.9
Robert Green 3.8
Julio Armstrong 1.1
Erik Cook 4.0
Jessica Hale 3.0
Vanessa Rivera 0.9
Sandra Ferguson 3.1
Christian Wang 1.1
Jackson Martinez 1.9
Austin Black 4.0

For your program, you will need to define a class Student, with private members for first name, last name, and GPA, and any methods you determine that you need (constructors, gets/sets, etc.) Once the class is defined, you will need to populate an array of Student objects to be sorted with data provided in the students.txt file.

First line in the text file will be size of the array.

Every line after the first contains three pieces of information, separated by spaces: First Name, Last Name, and GPA

and sort the Student data by GPA.(Using MergeSort or QuickSort)

display unsorted data and sorted data

In: Computer Science

Windows OS and System Admin AD FS gives users the ability to do a single sign-on...

Windows OS and System Admin

AD FS gives users the ability to do a single sign-on (SSO) and access applications on other networks without needing a secondary password. Organizations can set up trust relationships with other trusted organizations so a user’s digital identity and access rights can be accepted without a secondary password.

Group of answer choices

Primary domain controller

Backup domain controller

Read-only domain controller

Universal Group Membership caching

In: Computer Science

Use linux Original question: d) Use metacharacters and the ls -lL command (with lower and upper...

Use linux

Original question:

d) Use metacharacters and the ls -lL command (with lower and upper case L) to list all filenames under the datafiles directory that contain a dot '.' with the letter 'f' or 'u' anywhere after the dot.

e) Use metacharacters and a single ls -lL command (with lower and upper case L) to listall file names that contain a dot '.' followed by a lower case letter, then end with the letter 't' or 'r' as the second from last character. And these files should be from your current directory as well as any directory under the current directory that contains the letters "data".
For example: data1/a.pqrs would be a match, but dabta.Dtu and datafiles/.softdo not match.
Hint: use two command arguments, one for the current directory, and one for directories the contain 'data'.

Instructure sample output:

d)

-rwx------ 1 rpa b20003 2401 Sep 5 14:15 datafiles/famous.backup
-rwx------ 2 rpa b20003 2401 Sep 5 14:25 datafiles/famous.soft

e)

-rwx------ 2 rpa b20003 2401 Sep 5 14:25 datafiles/famous.hard
-rwx------ 2 rpal b20003 2401 Sep 5 14:25 famous.data

What I have so far:

[dfoote1$$$$$$ bin]$ ls -lL /students/dfoote1/bin/datafiles/*.*[fu]*
-rwx------ 1 dfoote1 students 2401 Sep 17 17:45 /students/dfoote1/bin/datafiles/famous.backup
-rwx------ 2 dfoote1 students 2401 Sep 17 16:15 /students/dfoote1/bin/datafiles/famous.soft
[dfoote1$$$$$$ bin]$ ls -ll /students/dfoote1/bin/datafiles/*.*[fu]*
-rwx------ 1 dfoote1 students 2401 Sep 17 17:45 /students/dfoote1/bin/datafiles/famous.backup
lrwxrwxrwx 1 dfoote1 students   33 Sep 17 17:40 /students/dfoote1/bin/datafiles/famous.soft -> /students/dfoote1/bin/famous.data

In: Computer Science

Write the main.c program for a PSoC project that takes an input byte and converts it...

Write the main.c program for a PSoC project that takes an input byte and converts it to an integer value in base 10 for subsequent processing within the program as an integer. (Example, 0x5A = 9010).

In: Computer Science

•A theater owner agrees to donate a portion of gross ticket sales to a charity •The...

•A theater owner agrees to donate a portion of gross ticket sales to a charity

•The program will prompt the user to input:

−Movie name

−Adult ticket price

−Child ticket price

−Number of adult tickets sold

−Number of child tickets sold

−Percentage of gross amount to be donated

•Inputs: movie name, adult and child ticket price, # adult and child tickets sold, and percentage of the gross to be donated

•The program needs to:

1.Get the movie name

2.Get the price of an adult ticket price

3.Get the price of a child ticket price

4.Get the number of adult tickets sold

5.Get the number of child tickets sold

In: Computer Science

Program Requirements: An Internet service provider has three different subscription packages for its customers: Package A:...


Program Requirements:

An Internet service provider has three different subscription
packages for its customers:

Package A: For $15 per month with 50 hours of access provided.
Additional hours are $2.00 per hour over 50 hours.
Assume usage is recorded in one-hour increments,

Package B: For $20 per month with 100 hours of access provided.
Additional hours are $1.50 per hour over 100 hours.

Package C: For $25 per month with 150 hours access is provided.
Additional hours are $1.00 per hour over 150 hours

Write a program that calculates a customer’s monthly charges.
Implement with the following functions for your solution.
getPackage
validPackage
getHours
validHours
calculatePkg_A
calculatePkg_B
calculatePkg_C
calculateCharges
showBill

----------------------------------------------
Demonstrate test cases as described in table:
---------------------------------------------- 
Test Case      Package           Hours
         1                   A                    50
         2                    a                    51
         3                    B                 100 
        4                     b                 101
        5                    C                  149
       6                      c                   151
       7                      e                  720
       8                      c                  722

In: Computer Science

Part I Define 1NF 2NF 3NF BCNF State the difference between 3NF and BCNF. Give one...

Part I

  • Define
    • 1NF
    • 2NF
    • 3NF
    • BCNF
  • State the difference between 3NF and BCNF.
  • Give one example schema that violates each of the following
    • 1NF
    • 2NF
    • 3NF

Your answer should contain three different schemas, one for each case.

In: Computer Science